Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. GetSchemeTable problem - IsKeyColumn

GetSchemeTable problem - IsKeyColumn

Scheduled Pinned Locked Moved Visual Basic
helpdata-structuresquestion
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Len Miller
    wrote on last edited by
    #1

    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

    L 1 Reply Last reply
    0
    • L Len Miller

      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

      L Offline
      L Offline
      Len Miller
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups