too many connections

djiceman

Member
Joined
Oct 20, 2006
Messages
10
Location
South Africa
Programming Experience
3-5
When is use the connection.open() and connection.close()

After about 100 times, errors come up:

An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll

Additional information: No error information available: E_FAIL(0x80004005).


Any idea what causes this or how can I work around it?

source code
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

Dim mysql = "UPDATE client set name=" & txtName.text & " WHERE clientid =" & txtClientid
Dim cmd As New OleDb.OleDbCommand(mysql, fdCon)
fdCon.Open()
cmd.ExecuteNonQuery()
fdCon.Close()

End Sub

So basically, if someone updates around 100 records this way, the program crashes. This also happens if I had to read 100 different records from the database, this viewing one record at a time.

I found that use a dataset to view the database is better and causes no errors, but I have problems updating the database using the adapter.update methods. Found here:

Please help
 
Top Bottom