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

    Unanswered: How to store/display more than one tables/recordset

    see the follow code:
    can return more than one recordset/table
    the datagrid can show more than one table at a time.
    1.the problem is how to store more than one table in a dataset at a time.
    2.see sql(2),sql(3), the new table 't1' is empty, after exec sql(3) will meet a "System.Data.OleDb.OleDbException",the sql(2) can pass without return recordset, but sql(3) return a null recordset(maybe). What should I do.

    Public Function m_execsql()
    Dim connStr As String
    connStr = "User ID=sa;Password=sa;Initial Catalog=Northwind;Provider=""SQLOLEDB.1"";Data Source=MINGLEI"
    conn = New System.Data.OleDb.OleDbConnection(connStr)
    Dim sql(3) As String
    sql(0) = "select * from products;"
    sql(1) = "select * from orders;"
    sql(2) = "create table t1;"
    sql(3) = "seletc * from t1;"
    Dim i As Integer
    For i = 0 To sql.GetUpperBound(0) - 1
    da = New OleDb.OleDbDataAdapter(sql(i), conn)
    Catch e As Exception
    End Try
    ds = New DataSet("dsTable")
    dt = New DataTable
    'grd.SetDataBinding(ds, i.ToString)
    grd.DataSource = dt
    'Catch eds As Exception
    ' MessageBox.Show(eds.Message)
    'End T
    conn = Nothing
    End Function

  2. #2
    Join Date
    Sep 2003

    Re: How to store/display more than one tables/recordset

    iqueen, you can use multiple data adapters to fill one dataset or if your sql statement returned more than one result set.

    Here's more from MS KB:

    You may want post in .Net section too....

Posting Permissions

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