GetSchemeTable problem - IsKeyColumn
-
According to my help document IsKeyColumn is one of the columns returned when you execute a data reader for GetSchemeTable When I execute this code: reader = cmdSel.ExecuteReader(CommandBehavior.KeyInfo) Dim dt As DataTable = reader.GetSchemaTable While reader.Read() If dt.Rows(idx).Item("IsKeyColumn") = True then . . . I get this error on the "If" line Column 'IsKeyColumn' does not belong to table SchemaTable. Any help?????? Thanks, -Len Miller "If I had eight hours to chop down a tree, I'd spend six sharpening my axe." -Abraham Lincoln
-
According to my help document IsKeyColumn is one of the columns returned when you execute a data reader for GetSchemeTable When I execute this code: reader = cmdSel.ExecuteReader(CommandBehavior.KeyInfo) Dim dt As DataTable = reader.GetSchemaTable While reader.Read() If dt.Rows(idx).Item("IsKeyColumn") = True then . . . I get this error on the "If" line Column 'IsKeyColumn' does not belong to table SchemaTable. Any help?????? Thanks, -Len Miller "If I had eight hours to chop down a tree, I'd spend six sharpening my axe." -Abraham Lincoln
As it turns out - I dumped the schematable to see the column names CONTRARY to my documentation, the column is named "IsKey" not "IsKeyColumn" grrrmph.... If anyone cares, I attached code that dumps the schematable: reader = cmdSel.ExecuteReader(CommandBehavior.KeyInfo) Dim dt As DataTable = reader.GetSchemaTable Dim schemaTable As DataTable Dim myProperty As DataColumn Dim str As String = "" Dim myField As DataRow schemaTable = reader.GetSchemaTable() For Each myField In schemaTable.Rows 'For each property of the field... For Each myProperty In schemaTable.Columns 'Display the field name and value. str = String.Concat(str, _ String.Format("[{0}]=[{1}]{2}" _ , myProperty.ColumnName _ , myField(myProperty).ToString() _ , Microsoft.VisualBasic.ControlChars.CrLf) _ ) Next Next MessageBox.Show(str) Thanks, -Len Miller "If I had eight hours to chop down a tree, I'd spend six sharpening my axe." -Abraham Lincoln