#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2001
    Location
    USA
    Posts
    313
    Rep Power
    18

    System.Data.SqlClient.SqlException: General network error


    When filling a dataset I am getting this error.
    Me.daProject.Fill(Me.dsProject.Project)

    PHP Code:
    An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll

    Additional information
    System error.

    System.Data.SqlClient.SqlExceptionGeneral network error.  Check your network documentation.
       
    at System.Data.SqlClient.SqlConnection.OnError(SqlException exceptionTdsParserState state)
       
    at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exceptionTdsParserState state)
       
    at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
       
    at System.Data.SqlClient.TdsParser.ReadNetlib(Int32 bytesExpected)
       
    at System.Data.SqlClient.TdsParser.ReadBuffer()
       
    at System.Data.SqlClient.TdsParser.ReadByteArray(Byte[] buffInt32 offsetInt32 len)
       
    at System.Data.SqlClient.TdsParser.ReadString(Int32 length)
       
    at System.Data.SqlClient.TdsParser.ReadValue(_SqlMetaData mdInt32 length)
       
    at System.Data.SqlClient.SqlDataReader.SeqRead(Int32 iBoolean useSQLTypesBoolean byteAccessBooleanisNull)
       
    at System.Data.SqlClient.SqlDataReader.SeqRead(Int32 iBoolean useSQLTypesBoolean byteAccess)
       
    at System.Data.SqlClient.SqlDataReader.GetValues(Object[] values)
       
    at System.Data.Common.SchemaMapping.LoadDataRow(Boolean clearDataValuesBoolean acceptChanges)
       
    at System.Data.Common.DbDataAdapter.FillLoadDataRow(SchemaMapping mapping)
       
    at System.Data.Common.DbDataAdapter.FillFromReader(Object dataString srcTableIDataReader dataReaderInt32 startRecordInt32 maxRecordsDataColumn parentChapterColumnObject parentChapterValue)
       
    at System.Data.Common.DbDataAdapter.Fill(DataTable dataTableIDataReader dataReader)
       
    at System.Data.Common.DbDataAdapter.Fill(Object dataInt32 startRecordInt32 maxRecordsString srcTableIDbCommand commandCommandBehavior behavior)
       
    at System.Data.Common.DbDataAdapter.Fill(DataTable dataTableIDbCommand commandCommandBehavior behavior)
       
    at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
       
    at ProjectOpening.frmProjectInfo..ctor() in c:\temp\myProject\frmProjectInfo.vb:line 39 
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2001
    Location
    USA
    Posts
    313
    Rep Power
    18
    Hello All,

    Well it would seem if I query one record at a time it works just fine but if I query all the records in the table I get the above error. I guess now I am wondering if I have some corrupt records and will this come back to haunt me later when a user queries that record.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Posts
    2
    Rep Power
    0

    Angry Same Problem


    I am having the same problem. We think we've narrowed it down to data size, and here is why:

    We have a query that returns about 3,000 records. If we run our process that executes this query, we get the General Network Error. If we return TOP 701 * it works. If we return TOP 702 * it fails with the same error. At that point, you would have to figure it was data related on that 702 record, but it's not. We limited the number of fields and were able to increase the number of rows returned. No matter what we changed, there seems to be a data size threshhold on that query.

    We've tried filling a DataSet and executing and SqlDataReader and get the same results.

    What makes it even stranger, is that this only happens when running on one particualar box. Database server is a SqlServer 2000 box and the web server is a Windows 2000 box. When running the process on another machine, it works fine.
    This problem has stumped our entire IT department. It was suggested that we update the MDAC, which we did, and we still have the same error.

    Anyone have ANY insight to this?
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Posts
    2
    Rep Power
    0
    Almost a week later, just when you've given up hope...

    Well, this problem has been solved. After being bounced back in forth between DBA's, developers, Network Admins and some of our local astrologist, we think we found a bug in ADO.NET (maybe).

    The query we were using had several conditions in the WHERE clause. We got it down to where we could comment out 1 clause and the query would work fine. Add it back in, General Network Error.

    After a few hours a screwing with the query, one of the DBA's (whom we shall now refer to as 'The Hero'), decided to add an ORDER BY clause so we could do some debugging.

    Sure enough, the processes executed and completed.

    Our initial conlusion is that the order in which the OR clauses where written and the absences of an ORDER BY, ADO.NET chocked on the execution plan. The query without the ORDER BY works fine in query analyzer and the process works fine running on other computers, so we don't know if there is something specific about that environment on that one particular server (unable to test right now).

    So my suggestion to the original poster is to simply add an ORDER BY if you don't already have one and see if that is the problem.

    Hope this helps.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2001
    Location
    USA
    Posts
    313
    Rep Power
    18
    This works just fine but if I took off the WHERE it did not work.
    SELECT * FROM dbo.Project WHERE (ProjectNumber = 'X12345')

    I tried this and I get the same error.
    SELECT * FROM dbo.Project ORDER BY ProjectNumber

    I am pulling back say 20,000 - 30,000 records but I readlly do not need to do this because I am making use of the disconnected database structure of ADO.NET.

    I am using using SQL Server 7 on win2k server it is a pretty beefy machine so I know hardware is not an issue. You said you updated the mdac drivers but I do not think this is an issue of mdac drivers. It almost acts like while it is retrieving records it disconnects in the middle of the process after a certain length of time like 2 to 5 seconds.

    I think it is either working as designed and not documented or it is a bug since there has not been any Service Packs on this yet I am sure there are still bugs.

    I have diagnosed everything from server to network to local system and can not place my finger on why it chokes or disconnects from the datasource while retrieving messages..
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2004
    Posts
    1
    Rep Power
    0
    I was having similar problems. Some of the posts in this thread pointed me towards the right direction.

    Initially I thought it was record size. When I trapped the error, long running queries that worked correctly in Query Analyzer would crash after 30 seconds in the VB.NET application.

    There is a property in the SQLCommand object called CommandTimeout. The default time is 30 seconds. When I changed the value to 180 seconds, everything worked.

    myCmd.CommandTimeout = 180
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2001
    Location
    USA
    Posts
    313
    Rep Power
    18
    Hey pgarnier,

    Thanks for the post back. Wow this is an old post I have since then went a different direction with my program but am glad you posted the Timeout code makes sence.
  14. #8
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2005
    Posts
    2
    Rep Power
    0

    Don't Confuse the Errors


    pgarnier -

    You are referring to a SQLTIMEOUT exception. This thread is discussing General Network Exception.

    Totally different animal.
  16. #9
  17. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2005
    Posts
    1
    Rep Power
    0
    I have the same kind of Error

    [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionCheckForData (CheckforData()).
    Server: Msg 11, Level 16, State 1, Line 0
    General network error. Check your network documentation.

    Connection Broken

    My Query is
    select * from Table order by Name

    But if i tried with
    select * from Table order by Field
    or
    select * from Table

    What i got is, if i tried order by with field name 'name'
    i got this error.
  18. #10
  19. Inherits Programmer.Slacker
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Aug 2003
    Location
    Between my Id and your Ego
    Posts
    2,351
    Rep Power
    726
    krs - post your code. Take out any sensitive information like servernames, tables, usernames, and passwords, and replace with a generic name like "source = 'SERVER'". Let us see what you're doing.
    Fisherman

    "Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." - A.Einstein
  20. #11
  21. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2014
    Posts
    1
    Rep Power
    0

    General network error


    Hello,

    I can confirm that I was waiting for a stored procedure to end, and I was getting a "general network error" instead of an error mentioning some tipe of timeout. I've resolved it by setting the command timeout too.

    Thanks !

    Roger
  22. #12
  23. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,440
    Rep Power
    4539
    Let's not resurrect a 10-year old thread. Topic closed.
    ======
    Doug G
    ======
    Bartender to Rene Descartes "have another beer?" Descartes: "I think not" and he vanished.
    --Alfred Bester

IMN logo majestic logo threadwatch logo seochat tools logo