Problems with connection management
- From: "Mattinsalto" <superdrive01@xxxxxxxxx>
- Date: 16 May 2006 01:00:29 -0700
Hello, I am trying to make a program that whenever it must do any
operation against the data base verifies that the connection is valid.
In order to test it I stop SQL server service and restart it. I have
tried to verify the state of the connection with
"connection.state", but has been useless because the state was
always open, although I restarted the service, so it crashed. I have
decided to use a new connection each time i have to connect to the
database, but it crash too. this is the code:
''Everytime I have to connect to DB I call a function who creates a new
connection:
''The conn variable is global
....
conn = Nothing
iniSQL()
....
Public sub iniSQL()
Try
conn = New System.Data.SqlClient.SqlConnection(GetConStr())
conn.Open()
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End sub
When it crashes the throwed exception is "general network error"
The code works fine if I don't stop and restart the sql Server service.
¿Any ideas?
Thanks in advance
.
- Follow-Ups:
- Re: Problems with connection management
- From: Mattinsalto
- Re: Problems with connection management
- From: Jan Hyde
- Re: Problems with connection management
- Prev by Date: Re: Report
- Next by Date: Pictures
- Previous by thread: Report
- Next by thread: Re: Problems with connection management
- Index(es):
Relevant Pages
|