SQL General Network Error
Posted by Bill Williams, Last modified by Andy Williams on 26 November 2006 09:37 PM
Please note the SQL server is connected through TCP/IP. The SQL server is not local to the machine where your IIS site resides. Therefore, you'll want to take that into consideration when building your .NET application.|
Here are few tips:
myParameter.Size = 8000;
This works fine with SQL 2000 without SP3. After installing SP3, we got the General Network Error.
Turns out that if the parameter is of type NVarChar (which is limited to 4000), you'll get that exception if you have set the parameter's size to be more than that limit, so I guess SP3 is more strict on that.
2)You also get that problem if you set the incorrect data type for your parameter. Make sure that whatever type you set that it matches what is in stored procedure.
3)Someone that didnt know .NET at all was looking at the code one day while I was at lunch... and added in a reference to an ADO.OLD Command object. Didnt even use it mind you, but DIM'd it in the code... and everything worked fine. Ugh. Obviously I dont like that answer...
4)we found later that apparently the CommandTimeout property was not working properly. We had it set to 0, which is supposed to be "infinite" but with that setting, the General Network Error would happen, but only on that one sproc. On other sprocs it ran fine. By changing that value to a "high" number (I think it was 90 seconds we tried), it ran fine.
The error is generally:
[SqlException: General network error. Check your network documentation.]
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) +742
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior) +45
System.Data.SqlClient.SqlCommand.System.Data.IDbCommand.ExecuteReader (CommandBehavior behavior) +5
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +304
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +77
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +36
TimeList.Main.Page_Load(Object sender, EventArgs e) +119
System.Web.UI.Control.OnLoad(EventArgs e) +67