too many connections on update?

djiceman

Member
Joined
Oct 20, 2006
Messages
10
Location
South Africa
Programming Experience
3-5
Im using a combobox to view the the primary key from a mysql database.
Upon combox selected index change, the text boxes get the new info for that specific primary key.

My problem is, when I scroll the combobox with the keyboard, by just holding down the down or up arrow keys, after I scroll around 95-100 items, I get an error:

System.Data.OleDb.OleDbException: No error information available: E_FAIL(0x80004005).
at System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr)
at System.Data.OleDb.OleDbConnection.InitializeProvider()
at System.Data.OleDb.OleDbConnection.Open()
at WindowsApplication5.Form1.id_SelectedIndexChanged_1(Object sender, EventArgs e) in C:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\WindowsApplication5\Form1.vb:line 157
at System.Windows.Forms.ComboBox.OnSelectedIndexChanged(EventArgs e)
at System.Windows.Forms.ComboBox.WmReflectCommand(Message& m)
at System.Windows.Forms.ComboBox.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.SendMessage(HandleRef hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.Control.SendMessage(Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.Control.ReflectMessageInternal(IntPtr hWnd, Message& m)
at System.Windows.Forms.Control.WmCommand(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.GroupBox.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.NativeWindow.DefWndProc(Message& m)
at System.Windows.Forms.Control.DefWndProc(Message& m)
at System.Windows.Forms.Control.WmCommand(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ComboBox.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.ComboBox.DefChildWndProc(Message& m)
at System.Windows.Forms.ComboBox.ChildWndProc(Message& m)
at System.Windows.Forms.ChildWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)



Could this be because its scrolling to fast and its not closing the connections fast enough?

Heres my combobox index selected code:

Private Sub id_SelectedIndexChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles id.SelectedIndexChanged
Dim temp As Integer
temp = id.SelectedItem
Dim fdCom1 As New OleDb.OleDbCommand("SELECT * FROM client where clientid =" & temp, fdCon)
fdCom1.Connection.Open()
Try
Dim fdRead1 As OleDb.OleDbDataReader = fdCom1.ExecuteReader(CommandBehavior.CloseConnection)
While fdRead1.Read
TextBox1.Text = fdRead1.GetValue(1)
End While
Catch myerror As Exception
MessageBox.Show("Error Connecting to Database: " & myerror.Message)
fdCon.Dispose()
End Try
fdCon.Close()
End Sub


Please assist, btw is this the best way for reading the database information into my program?

Thanks
Nolan
 
Top Bottom