Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2003
    Posts
    66

    Question Unanswered: Can a datagrid display more than one table?

    See this picture. I only see table '2' can add more table? how?
    conn.Open()
    Dim sql(3) As String

    sql(0) = "select * from products;"
    sql(1) = "select * from orders;"
    sql(2) = "select * from orders;"
    sql(3) = "select * from orders;"

    Dim da As System.Data.OleDb.OleDbDataAdapter
    Dim ds As DataSet
    Dim dt As DataTable
    Dim i As Integer

    For i = 0 To sql.GetUpperBound(0)
    Try
    da = New OleDb.OleDbDataAdapter(sql(i), conn)
    Catch e As Exception
    MessageBox.Show(e.Message)
    End Try
    Try
    ds = New DataSet("dsTable")
    dt = New DataTable(i.ToString)
    da.Fill(dt)
    'ds.Tables.Add(dt)
    ds.Tables.Add(dt)
    ds.Merge(dt)
    'grd.SetDataBinding(ds, i.ToString)
    'MessageBox.Show(ds.Tables(i).TableName)
    grd.DataSource = ds
    Catch eds As Exception
    MessageBox.Show(eds.Message)
    End Try
    MessageBox.Show(i)
    Next
    conn.Close()
    conn = Nothing
    Attached Thumbnails Attached Thumbnails po.gif  

  2. #2
    Join Date
    Sep 2003
    Posts
    66
    let me answer it myself.
    for i = 0 to n
    da.Fill(dt)
    ds.Merge(dt)
    next
    datagrid.datasource = ds

Posting Permissions

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