Retrieving Data Using the AseDataAdapter Object

Fill a DataSet using the AseDataAdapter with the given example.

  1. Connect to the database.
  2. Create a new DataSet. In this case, the DataSet is called “Results.”

    For C#:

    DataSet ds =new DataSet ();

    For Visual Basic .NET:

    Dim ds As New DataSet()
  3. Create a new AseDataAdapter object to execute a SQL statement and fill the DataSet called “Results”:

    For C#:

    AseDataAdapter da=new
       AseDataAdapter(txtSQLStatement.Text, _conn); 
    da.Fill(ds, "Results"),

    For Visual Basic .NET:

    Dim da As New 
       AseDataAdapter(txtSQLStatement.Text, conn)
    da.Fill(ds, "Results")
  4. Bind the DataSet to the grid on the window:

    For C#:

    dgResults.DataSource = ds.Tables["Results"],

    For Visual Basic .NET:

    dgResults.DataSource = ds.Tables("Results")