No exception raised on connection.open() while disconnected with the database

  • Thread starter Thread starter Farrukh
  • Start date Start date
F

Farrukh

Hi All!

I have a problem when connecting to a remote SQL Server
database through .NET Sql Data Provider (using

system.data.sqlclient).

The situation is that the client machine's network
connection is explicitly broken once after successfull
retrival of records

from the database.
So when the following line of code runs after the
connection is broken:

sqlConnection.Open();

....it dont gives any exception. However after that the
exception is raised when querying the database. i.e. at:

sqlDataAdapter.Fill(dataTable);
...


(Note that Connection Pooling is enabled)

Exception raised is:
"General network error. Check your network documentation."

Stack Trace:
at System.Data.SqlClient.SqlCommand.ExecuteReader
(CommandBehavior cmdBehavior, RunBehavior runBehavior,
Boolean returnStream)
at System.Data.SqlClient.SqlCommand.ExecuteReader
(CommandBehavior behavior)
at
System.Data.SqlClient.SqlCommand.System.Data.IDbCommand.Ex
ecuteReader(CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.FillFromCommand
(Object data, Int32 startRecord, Int32 maxRecords, String
srcTable,

IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable
dataTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable
dataTable)
at ....

Kindly help me finding a solution to handle this problem.

Looking forward

Regards,
Farrukh
 
Hi

Are you trying to connect to default instance/ named
instance of sql server?

Ravikanth
 
Farrukh said:
Hi All!

I have a problem when connecting to a remote SQL Server
database through .NET Sql Data Provider (using

system.data.sqlclient).

The situation is that the client machine's network
connection is explicitly broken once after successfull
retrival of records

from the database.
So when the following line of code runs after the
connection is broken:

sqlConnection.Open();

...it dont gives any exception. However after that the
exception is raised when querying the database. i.e. at:

sqlDataAdapter.Fill(dataTable);
...


(Note that Connection Pooling is enabled)

Exception raised is:
"General network error. Check your network documentation."

In your connection string, do you have "Connection Reset" turned off?

If so, turn it back on.
David
 
Back
Top