Losing SQL Connection

M

Mike

While working on a few projects I have this annoying issue whereby my
computer is losing the connection to my SQL database. I have to save my
work exit VS log out of windowsXP and log back in, relaunch VS and load my
program to resume. I'm getting the following error about every 10 minutes.

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

Additional Information: System error.

The error ocurrs on this line:
SqlDataAdapter1.Fill(ClientListDS1)

I'm hoping someone can shed some light on what may be causing this. The SQL
database is on a SBS2003 server.

Thanks,
Mike
 
K

Ken Tucker [MVP]

Hi,

Try enclosing the update command in a try catch block so you get
a better error message.

Try
SqlDataAdapter1.Fill(ClientListDS1)
Catch ex as exception
messagebox.show(ex.tostring)
end try

Ken
----------------
While working on a few projects I have this annoying issue whereby my
computer is losing the connection to my SQL database. I have to save my
work exit VS log out of windowsXP and log back in, relaunch VS and load my
program to resume. I'm getting the following error about every 10 minutes.

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

Additional Information: System error.

The error ocurrs on this line:
SqlDataAdapter1.Fill(ClientListDS1)

I'm hoping someone can shed some light on what may be causing this. The SQL
database is on a SBS2003 server.

Thanks,
Mike
 
G

Guest

Or better yet catch a SQLexception type for the best info:

Catch ex as SqlClient.SqlException
 
M

Mike

It is returning:
System.Data.SqlClient.SqlException: Cannot generate SSPI context.
at System.Data.SqlClient.ConnectionPool.GetConnection(Boolean&
isInTransaction)
at
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString
options, Boolean& isInTransaction)
at System.data.SqlClient.SqlConnection.Open()
at System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection,
ConnectionState& originalState)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
at WindowsApplication2.Form1.Form1_Load(Object sender, EventArgs e) in
C:\vbdotnet\testapps\WindowsApplication2\Form1.vb:line1282

That was a lot of typing. So, most search results indicate that this is a
rights issue; however, I have tested various permission settings and have
not been able to resolve the issue. Also, it doesn't occur right away. - I
have access to the SQL data for about 10 minutes before I lose the
connection. I have my username set in AD for 'Account is trusted for
delegation' and the issue is reproducible while logged in as administrator
as well..... I'm at a loss....

Thanks,
Mike
 
M

Mike

Thanks,
I changed the catch statement but it returns the same results - see my
response to Ken for details on the error.

Thanks,
mike
 
A

Armin Zingler

Mike said:
It is returning:
System.Data.SqlClient.SqlException: Cannot generate SSPI context.
at System.Data.SqlClient.ConnectionPool.GetConnection(Boolean&
isInTransaction)
at
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString
options, Boolean& isInTransaction)
at System.data.SqlClient.SqlConnection.Open()
at System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection
connection, ConnectionState& originalState)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
at WindowsApplication2.Form1.Form1_Load(Object sender, EventArgs
e) in C:\vbdotnet\testapps\WindowsApplication2\Form1.vb:line1282

That was a lot of typing.

Typing the callstack? Why not use the clipboard? :)

Maybe the people in the ADO.net group can help you:
microsoft.public.dotnet.framework.adonet

Armin
 
M

Mike

Thanks Cor,
Disposing of the connection appears to have resolved the issue. I'm
surprised that (1) using the wizard to create the connection doesn't take
care of this automatically (2) the beginner books I am studying don't hit
this point emmediately (they mayy touch on it later in the books).
Nontheless, thank you for the help.

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top