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

    Question Unanswered: howto to check have recordset return

    In order to fill datagird my code as follow:
    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)
    conn.Open()
    Dim sql(3) As String
    sql(0) = "select * from product;"
    sql(1) = "select * from orders;"
    sql(2) = "SELECT * FROM Customers;"
    sql(3) = "SELECT * FROM Customers;"
    Dim i As Integer
    For i = 0 To sql.GetUpperBound(0) - 1
    Try
    da = New OleDb.OleDbDataAdapter(sql(i), conn)
    Catch e As Exception
    MessageBox.Show(e.Message)
    End Try
    Try
    dt = New DataTable
    ds = New DataSet("n" & i.ToString)
    MessageBox.Show("n" & i.ToString)
    da.Fill(ds, "n" & i.ToString)
    grd.SetDataBinding(ds, "n" & i.ToString)
    'grd.DataSource = ds
    Catch eds As Exception
    MessageBox.Show(eds.Message)
    End Try
    Next
    conn.Close()
    conn = Nothing
    End Function
    These code will get an error after a no recordset sql stmt.
    How to have a check whether the sql stmt have recordset return. Use which/what function to check.
    Thanks.
    Last edited by iqueen; 09-12-03 at 06:39.

Posting Permissions

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