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.
Printable View
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.
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?
my dataset is filled by a sql like this:
VB Code:
sql = "Select tblModule.* ,tblTemplateModule.TemplateIndex From tblModule,tblTemplateModule " 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:
daTemplateModule.SelectCommand = New OdbcCommand(sql) daTemplateModule.SelectCommand.Connection = New OdbcConnection(conString) daTemplateModule.SelectCommand.Connection.Open() Try dsTemplateModule.Clear() moduleCount = daTemplateModule.Fill(dsTemplateModule) ' daModule.SelectCommand.ExecuteNonQuery() Catch MyOdbcException As OdbcException Console.WriteLine(MyOdbcException.ToString) End Try For i = 0 To moduleCount - 1 ' For Each moduleRow In dsTemplateModule.Tables(0).Rows Dim moduleNode As TreeNode = New TreeNode() moduleNode.ForeColor = Color.DarkGreen moduleNode.ImageIndex = 1 moduleNode.Text = dsTemplateModule.Tables(1).Columns("Name").ToString templateNode.Nodes.Add(moduleNode) next i