Results 1 to 3 of 3

Thread: get data from dataset

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Posts
    471

    get data from dataset

    I have a dataset, which is filled by a query of 3 tables. Now I want to get a column data from the dataset, how? thanks.

  2. #2
    Fanatic Member VBCrazyCoder's Avatar
    Join Date
    Apr 2003
    Posts
    681
    This has some basics on filling a dataset and getting data from it:

    http://msdn.microsoft.com/library/de...ClassTopic.asp

    Although I am a bit confused - it would seem that the harder thing to do would be to actually get the data into the dataset, no get the data out of the dataset. Do I understand you correctly?

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Posts
    471
    my dataset is filled by a sql like this:
    VB Code:
    1. sql = "Select tblModule.* ,tblTemplateModule.TemplateIndex From tblModule,tblTemplateModule "
    2.             sql = sql + "Where tblModule.ModuleNumber = tblTemplateModule.ModuleNumber and tblTemplateModule.TemplateIndex = " + Str(templateRow("TemplateIndex"))

    I get one record from the query and want to display tbllModule.Name to a treeview control. But I just can not get that column data.

    VB Code:
    1. daTemplateModule.SelectCommand = New OdbcCommand(sql)
    2.             daTemplateModule.SelectCommand.Connection = New OdbcConnection(conString)
    3.             daTemplateModule.SelectCommand.Connection.Open()
    4.             Try
    5.                 dsTemplateModule.Clear()
    6.                 moduleCount = daTemplateModule.Fill(dsTemplateModule)
    7.                 ' daModule.SelectCommand.ExecuteNonQuery()
    8.             Catch MyOdbcException As OdbcException
    9.                 Console.WriteLine(MyOdbcException.ToString)
    10.  
    11.             End Try
    12.  
    13.             For i = 0 To moduleCount - 1
    14.                 '    For Each moduleRow In dsTemplateModule.Tables(0).Rows
    15.                 Dim moduleNode As TreeNode = New TreeNode()
    16.                 moduleNode.ForeColor = Color.DarkGreen
    17.                 moduleNode.ImageIndex = 1
    18.                 moduleNode.Text = dsTemplateModule.Tables(1).Columns("Name").ToString
    19.                 templateNode.Nodes.Add(moduleNode)
    20.         next i

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width