Datagrid datasource binding error

G

Guest

I get the following error:

Unhandled Exception, Log_Id does not belong to table Queue

.... when I execute the following code ("dgQueue" is my datagrid control):

Dim dtQueue As DataTable = gclsDataLayer.GetQueue()
dgQueue.DataSource = Nothing
dgQueue.SetDataBinding(dtQueue, "")
dgQueue.Refresh()

I get the error on the SetDataBinding call. The above code lives in a
Function that is called every one minute (by using a Timer control). The
first couple of times through the Function, I don't get the error. After a
10-30 times, I'll get the error. When the exception is thrown, I check the
contents of the dtQueue DataTable, and the column does, in fact, exist! I
put a try catch around the call, and I can't catch the exception!

If you don't know the solution to the datagrid issue, could you provide some
assistance in catching this exception? As a last resort I could jsut catch
and swallow the exception, but right now I can't seem to even catch it.

Thanks guys!
 
G

Guest

Here is the Stack Trace on that exception:

************** Exception Text **************
System.ArgumentException: Column 'Log_ID' does not belong to table Queue.
at System.Data.DataRow.CheckColumn(DataColumn column)
at System.Data.DataRow.get_Item(DataColumn column, DataRowVersion version)
at System.Data.DataRowView.GetColumnValue(DataColumn column)
at System.Data.DataColumnPropertyDescriptor.GetValue(Object component)
at
System.Windows.Forms.DataGridColumnStyle.GetColumnValueAtRow(CurrencyManager
source, Int32 rowNum)
at System.Windows.Forms.DataGridTextBoxColumn.Edit(CurrencyManager
source, Int32 rowNum, Rectangle bounds, Boolean readOnly, String instantText,
Boolean cellIsVisible)
at System.Windows.Forms.DataGrid.Edit(String instantText)
at System.Windows.Forms.DataGrid.Edit()
at System.Windows.Forms.DataGrid.OnEnter(EventArgs e)
at System.Windows.Forms.Control.NotifyEnter()
at System.Windows.Forms.ContainerControl.UpdateFocusedControl()
 

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