Contents Index Using the AsaDataAdapter object to access and manipulate data Inserting, updating, and deleting rows using the AsaDataAdapter object

ASA Programming Guide
  Developing Applications with the .NET Data Provider
    Accessing and manipulating data
      Using the AsaDataAdapter object to access and manipulate data

Getting data using the AsaDataAdapter object

The AsaDataAdapter allows you to view the entire result set by using the Fill method to fill a DataSet with the results from a query by binding the DataSet to the display grid.

Using the AsaDataAdapter, you can pass any string (SQL statement or stored procedure) that returns a result set. When you use the AsaDataAdapter, all the rows are fetched in one operation using a forward-only, read-only cursor. Once all the rows in the result set have been read, the cursor is closed. The AsaDataAdapter allows you to make changes to the DataSet. Once your changes are complete, you must reconnect to the database to apply the changes.

You can use the AsaDataAdapter object to retrieve a result set that is based on a join. However, you can only make changes (inserts, updates, or deletes) to data that is from a single table. You cannot update result sets that are based on joins.

Caution 
Any changes you make to the DataSet are made while you are disconnected. This means that your application does not have locks on these rows in the database. Your application must be designed to resolve any conflicts that may occur when changes from the DataSet are applied to the database in the event that another user changes the data you are modifying before your changes are applied to the database.

For more information about the AsaDataAdapter, see AsaDataAdapter class.

AsaDataAdapter example 

The following example shows how to fill a DataSet using the AsaDataAdapter.

To retrieve data using the AsaDataAdapter object

  1. Connect to the database.

  2. Create a new DataSet. In this case, the DataSet is called Results.

    DataSet ds =new DataSet ();
  3. Create a new AsaDataAdapter object to execute a SQL statement and fill the DataSet.

    AsaDataAdapter da=new AsaDataAdapter(
         txtSQLStatement.Text, _conn);
    da.Fill(ds, "Results")
  4. Bind the DataSet to the grid on the screen.

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

Contents Index Using the AsaDataAdapter object to access and manipulate data Inserting, updating, and deleting rows using the AsaDataAdapter object