Datagrid datasource binding error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?cGpzaW1vbg==?=

    #1

    Datagrid datasource binding error

    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.G etQueue()
    dgQueue.DataSou rce = Nothing
    dgQueue.SetData Binding(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!
  • =?Utf-8?B?cGpzaW1vbg==?=

    #2
    RE: Datagrid datasource binding error

    Here is the Stack Trace on that exception:

    ************** Exception Text **************
    System.Argument Exception: Column 'Log_ID' does not belong to table Queue.
    at System.Data.Dat aRow.CheckColum n(DataColumn column)
    at System.Data.Dat aRow.get_Item(D ataColumn column, DataRowVersion version)
    at System.Data.Dat aRowView.GetCol umnValue(DataCo lumn column)
    at System.Data.Dat aColumnProperty Descriptor.GetV alue(Object component)
    at
    System.Windows. Forms.DataGridC olumnStyle.GetC olumnValueAtRow (CurrencyManage r
    source, Int32 rowNum)
    at System.Windows. Forms.DataGridT extBoxColumn.Ed it(CurrencyMana ger
    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(EventAr gs e)
    at System.Windows. Forms.Control.N otifyEnter()
    at System.Windows. Forms.Container Control.UpdateF ocusedControl()

    Comment

    Working...