StrataFrame Forum

Do not understand this error

http://forum.strataframe.net/Topic754.aspx

By ckelsoe - 3/30/2006

I am getting the error below that I do not understand. The field ID does exist as a PrimaryKey in an Access database.

System.ArgumentException was unhandled by user code
  Message="Column 'ID' does not belong to table tblCertHolders."
  Source="System.Data"
  StackTrace:
       at System.Data.DataRow.GetDataColumn(String columnName)
       at System.Data.DataRow.get_Item(String columnName)
       at FMLCertHolderConversion.boCertHolders.get_ID() in D:\FMLCertHolderConversion\FMLCertHolderConversion\boCertHolders.Designer.vb:line 239
       at FMLCertHolderConversion.boCertHolders.Field_ID_Descriptor.GetValue(Object component) in D:\FMLCertHolderConversion\FMLCertHolderConversion\boCertHolders.Designer.vb:line 735
       at MicroFour.StrataFrame.Business.BusinessLayer.get_Item(String FieldName)
       at MicroFour.StrataFrame.UI.Windows.Forms.ListView.CreateListViewItem(BusinessLayer BusinessObject)
       at MicroFour.StrataFrame.UI.Windows.Forms.ListView.PopulateListView(Object[] Parameters)
       at MicroFour.StrataFrame.UI.Windows.Forms.ListView.InitializeObject()
       at MicroFour.StrataFrame.UI.Windows.Forms.BaseForm.InitializeFormLoadObjects()
       at MicroFour.StrataFrame.UI.Windows.Forms.BaseForm.BaseForm_Load(Object sender, EventArgs e)
       at System.EventHandler.Invoke(Object sender, EventArgs e)
       at System.Windows.Forms.Form.OnLoad(EventArgs e)
       at System.Windows.Forms.Form.OnCreateControl()
       at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       at System.Windows.Forms.Control.CreateControl()
       at System.Windows.Forms.Control.WmShowWindow(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at System.Windows.Forms.ContainerControl.WndProc(Message& m)
       at System.Windows.Forms.Form.WmShowWindow(Message& m)
       at System.Windows.Forms.Form.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Here is the code that causes the error.

<Browsable(False), _
BusinessFieldDisplayInEditor(), _
Description(
"ID"), _
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
Public Property [ID]() As System.Int32
Get
Dim loRow As DataRow
loRow =
Me.CurrentRow
If loRow.RowState = DataRowState.Deleted Then
Return CType(loRow.Item("ID", DataRowVersion.Original), System.Int32)
Else
Return CType(loRow.Item("ID"), System.Int32)
End If
End Get
Set(ByVal value As System.Int32)
Me.CurrentRow.Item("ID") = value
End Set

End Property

By ckelsoe - 3/31/2006

Sinced there has not been a response,  I will add that this was strataframe generated code.
By Trent L. Taylor - 3/31/2006

Charles,

Is there any data in the business object when you reference this field?  If there is not any data in the business object you can get this error message.  If you call NewRow() before attempting to place data in the field do you get this same error?

By ckelsoe - 3/31/2006

This happens on the initial compile. I am not trying to add data or anything. I am just trying to compile the project for the first time.
By Trent L. Taylor - 4/3/2006

Charles,

The framework is trying to populate a ListView that you've dropped onto your form.  You have the PopulationDataSourceSettings configured to display the ID column in one of the ListView's columns.  The ID column has not been pulled from SQL Server, so it appears that whatever query you're executing within the PopulationDataSourceSettings, is not executing an SQL query that pulls in the ID column.  Check the "Method to Execute" and make sure that it fills the business object with a select statement that includes column "ID".