1 message in com.mysql.lists.dotnetOdd, occasional error| From | Sent On | Attachments |
|---|---|---|
| Barry Zubel | 16 Jun 2005 03:11 |
| Subject: | Odd, occasional error![]() |
|---|---|
| From: | Barry Zubel (bar...@zubel.co.uk) |
| Date: | 06/16/2005 03:11:32 AM |
| List: | com.mysql.lists.dotnet |
Hey guys (and gals)
I'm having the odd occasional error occur when running 1.0.4 against a 4.0.23 server.
Exception dump is:
Exception Details:
System.ArgumentException: Column 'SQTY' does not belong to table .
at System.Data.DataRow.CheckColumn(DataColumn column)
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.set_HorizontalOffset(Int32 value)
at System.Windows.Forms.DataGrid.LayoutScrollBars()
at System.Windows.Forms.DataGrid.ComputeLayout()
at System.Windows.Forms.DataGrid.OnLayout(LayoutEventArgs levent)
at System.Windows.Forms.Control.PerformLayout(Control affectedControl,
String affectedProperty)
at System.Windows.Forms.Control.PerformLayout()
at System.Windows.Forms.DataGrid.OnColumnCollectionChanged(Object sender,
CollectionChangeEventArgs e)
at
System.Windows.Forms.DataGridTableStyle.OnColumnCollectionChanged(Object
sender, CollectionChangeEventArgs e)
at
System.Windows.Forms.GridColumnStylesCollection.OnCollectionChanged(CollectionChangeEventArgs
ccevent)
at
System.Windows.Forms.GridColumnStylesCollection.ColumnStylePropDescChanged(Object
sender, EventArgs pcea)
at
System.Windows.Forms.DataGridColumnStyle.OnPropertyDescriptorChanged(EventArgs
e)
at
System.Windows.Forms.DataGridColumnStyle.set_PropertyDescriptor(PropertyDescriptor
value)
at
System.Windows.Forms.DataGridTextBoxColumn.set_PropertyDescriptor(PropertyDescriptor
value)
at
System.Windows.Forms.DataGrid.PairTableStylesAndGridColumns(CurrencyManager
lm, DataGridTableStyle gridTable, Boolean forceColumnCreation)
at System.Windows.Forms.DataGrid.SetDataGridTable(DataGridTableStyle
newTable, Boolean forceColumnCreation)
at System.Windows.Forms.DataGrid.Set_ListManager(Object newDataSource,
String newDataMember, Boolean force, Boolean forceColumnCreation)
at System.Windows.Forms.DataGrid.Set_ListManager(Object newDataSource,
String newDataMember, Boolean force)
at System.Windows.Forms.DataGrid.set_DataSource(Object value)
at Goose.frmJobView.DisplayEnNo() in
C:\work\Goose\source\Forms\Job\frmJobView.vb:line 3272
at Goose.frmJobView.PopulateTab(Int32 index) in
C:\work\Goose\source\Forms\Job\frmJobView.vb:line 3145
at Goose.frmJobView.tcMaster_SelectedIndexChanged(Object sender, EventArgs
e) in C:\work\Goose\source\Forms\Job\frmJobView.vb:line 3116
at System.Windows.Forms.TabControl.OnSelectedIndexChanged(EventArgs e)
at System.Windows.Forms.TabControl.WmSelChange(Message& m)
at System.Windows.Forms.TabControl.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)
Related code is:
Dim sSql As String Dim dt As DataTable
sSql = "SELECT S_MASTER.JOB_NO, S_MASTER.ISSUED, S_MASTER.REQD, INVOICED, SQTY, DELQTY, MATVAL, ESTVAL, UNITPRICE, EXVAT, " ' Calculate % from estimated sSql &= "ROUND(((S_MASTER.ORDVAL / S_MASTER.ESTVAL) - 1 ) * 100, 2) AS PERC " sSql &= " FROM S_MASTER" sSql &= " WHERE S_MASTER.EN_NO=" & job.EnNo
dt = GooseApp.DBFactory.RetrieveTable(sSql)
grdENNOList.DataSource = dt '<--- BANG!
The RetrieveTable function is:
Public Function RetrieveTable(ByVal sSql As String) As DataTable Try Dim conn As IDbConnection = CreateConnection() conn.Open() Dim comm As IDbCommand = CreateCommand(sSql, conn) Dim rs As DbDataAdapter = CreateAdapter(comm) Dim dt As New DataTable rs.Fill(dt) rs.Dispose() comm.Dispose() conn.Close() conn.Dispose() Return dt Catch ex As Exception HandleExceptionAndEmail(ex) End Try
End Function
Now, in my eyes, the SQTY column should always exist in the returned table, even if the datatable contains no rows?
Any thoughts on whether I'm just being stupid, or whether this could be a bugette in the connector?
B.




