|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Column 'Column' does not belong to table 'Table'Hello
I have a dataset which is successfully being filled. However whenever i try to access a givewn row of one of the tables in the dataset i get the error "Column 'ContactId' does not belong to table 'SalesAgent'" Except that it does and if i use an ordinal reference i can access the value of the column. If i print the schema sure enough the column is called ContactId. I have also noticed that if i hover the cursor over the contactrow i can access a treeview which lists all columns in the contactrow and then tells me that none of them belong to table salesagent. This was a conversion from 1.1 to 2.0. Any ideas? Thanks Lenny Hi,
How exactly are you accessing data? And where are your columns defined? -- Show quoteMiha Markic [MVP C#] RightHand .NET consulting & development www.rthand.com Blog: http://cs.rthand.com/blogs/blog_with_righthand/ "Learnicus" <spamthis@nospam.com> wrote in message news:eU65zlaQGHA.2692@TK2MSFTNGP14.phx.gbl... > Hello > > I have a dataset which is successfully being filled. However whenever i > try to access a givewn row of one of the tables in the dataset i get the > error > > "Column 'ContactId' does not belong to table 'SalesAgent'" > > Except that it does and if i use an ordinal reference i can access the > value of the column. If i print the schema sure enough the column is > called ContactId. I have also noticed that if i hover the cursor over the > contactrow i can access a treeview which lists all columns in the > contactrow and then tells me that none of them belong to table salesagent. > > This was a conversion from 1.1 to 2.0. Any ideas? > > Thanks > Lenny > Hi Miha,
The columns are defined as part of the strongly typed dataset schema. Im accessing the data as follows: If SalesTerritory.RelateSalesAgentsSalesTerritories(ds) Then Dim contactRow As dsContact.ContactRow contactRow = CType(activeTerritory.GetParentRow(SalesTerritory.RELATION_SAST), _ dsContact.ContactRow) If contactRow Is Nothing Then Me.lblSalesAgent.Text = "<Unknown>" Else Me.ViewState.Add("SalesAgentId", contactRow.ContactId) Me.lblSalesAgent.Text = contactRow.ContactName End If Else Global_asax.DenyRequestInternalError() End If This fails at runtime on the line :Me.ViewState.Add("SalesAgentId", contactRow.ContactId). With the message as per the subject line. There is data in contactrow and contactrow is not equal to nothing. If i use clng(contactrow(0)) i can get the data and if i use contactRow("ContactId") i can get the data. Thanks Lenny Show quote "Miha Markic [MVP C#]" <miha at rthand com> wrote in message news:eTpUuFcQGHA.1096@TK2MSFTNGP11.phx.gbl... > Hi, > > How exactly are you accessing data? And where are your columns defined? > > -- > Miha Markic [MVP C#] > RightHand .NET consulting & development www.rthand.com > Blog: http://cs.rthand.com/blogs/blog_with_righthand/ > > "Learnicus" <spamthis@nospam.com> wrote in message > news:eU65zlaQGHA.2692@TK2MSFTNGP14.phx.gbl... >> Hello >> >> I have a dataset which is successfully being filled. However whenever i >> try to access a givewn row of one of the tables in the dataset i get the >> error >> >> "Column 'ContactId' does not belong to table 'SalesAgent'" >> >> Except that it does and if i use an ordinal reference i can access the >> value of the column. If i print the schema sure enough the column is >> called ContactId. I have also noticed that if i hover the cursor over the >> contactrow i can access a treeview which lists all columns in the >> contactrow and then tells me that none of them belong to table >> salesagent. >> >> This was a conversion from 1.1 to 2.0. Any ideas? >> >> Thanks >> Lenny >> > > From the immediate window:
?contactrow {dsContact.ContactRow} AKey: {"Column 'AKey' does not belong to table SalesAgent."} ContactId: {"Column 'ContactId' does not belong to table SalesAgent."} ContactName: {"Column 'ContactName' does not belong to table SalesAgent."} ContactType: {"Column 'ContactType' does not belong to table SalesAgent."} HasErrors: False IPPassword: {"Column 'IPPassword' does not belong to table SalesAgent."} IPUsername: {"Column 'IPUsername' does not belong to table SalesAgent."} Item: In order to evaluate an indexed property, the property must be qualified and the arguments must be explicitly supplied by the user. ItemArray: {Length=9} LastModified: {"Column 'LastModified' does not belong to table SalesAgent."} RowError: "" RowState: Added {4} SinkState: {"Column 'SinkState' does not belong to table SalesAgent."} SiteId: {"Column 'SiteId' does not belong to table SalesAgent."} Table: {dsContact.ContactDataTable} ?contactrow(0) 13167 {Long} Long: 13167 {Long} ?contactrow("ContactId") 13167 {Long} Long: 13167 {Long} ?contactrow("Akey") "DIKE" {String} String: "DIKE" ?contactrow.Table {dsContact.ContactDataTable} dsContact.ContactDataTable: {dsContact.ContactDataTable} CaseSensitive: False ChildRelations: {System.Data.DataRelationCollection.DataTableRelationCollection} Columns: {System.Data.DataColumnCollection} Constraints: {System.Data.ConstraintCollection} Container: Nothing DataSet: {dsSalesTerritory} DefaultView: {System.Data.DataView} DesignMode: False DisplayExpression: "" ExtendedProperties: Count = 0 HasErrors: False IsInitialized: True Locale: {System.Globalization.CultureInfo} MinimumCapacity: 50 Namespace: "http://myco/myprod/dsSalesTerritory.xsd" ParentRelations: {System.Data.DataRelationCollection.DataTableRelationCollection} Prefix: "" PrimaryKey: {Length=0} RemotingFormat: Xml {0} Rows: {System.Data.DataRowCollection} Site: Nothing TableName: "SalesAgent" Lenny Show quote "Learnicus" <spamthis@nospam.com> wrote in message news:udlBqEjQGHA.4264@TK2MSFTNGP11.phx.gbl... > Hi Miha, > > The columns are defined as part of the strongly typed dataset schema. Im > accessing the data as follows: > > If SalesTerritory.RelateSalesAgentsSalesTerritories(ds) Then > Dim contactRow As dsContact.ContactRow > contactRow = > CType(activeTerritory.GetParentRow(SalesTerritory.RELATION_SAST), _ > dsContact.ContactRow) > If contactRow Is Nothing Then > Me.lblSalesAgent.Text = "<Unknown>" > Else > Me.ViewState.Add("SalesAgentId", contactRow.ContactId) > Me.lblSalesAgent.Text = contactRow.ContactName > End If > Else > Global_asax.DenyRequestInternalError() > End If > > This fails at runtime on the line :Me.ViewState.Add("SalesAgentId", > contactRow.ContactId). > With the message as per the subject line. There is data in contactrow and > contactrow is not equal to nothing. If i use clng(contactrow(0)) i can get > the data and if i use contactRow("ContactId") i can get the data. > > > Thanks > > Lenny > > > > > "Miha Markic [MVP C#]" <miha at rthand com> wrote in message > news:eTpUuFcQGHA.1096@TK2MSFTNGP11.phx.gbl... >> Hi, >> >> How exactly are you accessing data? And where are your columns defined? >> >> -- >> Miha Markic [MVP C#] >> RightHand .NET consulting & development www.rthand.com >> Blog: http://cs.rthand.com/blogs/blog_with_righthand/ >> >> "Learnicus" <spamthis@nospam.com> wrote in message >> news:eU65zlaQGHA.2692@TK2MSFTNGP14.phx.gbl... >>> Hello >>> >>> I have a dataset which is successfully being filled. However whenever i >>> try to access a givewn row of one of the tables in the dataset i get the >>> error >>> >>> "Column 'ContactId' does not belong to table 'SalesAgent'" >>> >>> Except that it does and if i use an ordinal reference i can access the >>> value of the column. If i print the schema sure enough the column is >>> called ContactId. I have also noticed that if i hover the cursor over >>> the contactrow i can access a treeview which lists all columns in the >>> contactrow and then tells me that none of them belong to table >>> salesagent. >>> >>> This was a conversion from 1.1 to 2.0. Any ideas? >>> >>> Thanks >>> Lenny >>> >> >> > > |
|||||||||||||||||||||||