Updating datasource using dataadapter

Rated 4.7/5 based on 512 customer reviews

Now you'll create your first sample using data adapters.

In this sample example, I'll show you how to create data adapters using Sql and Ole Db data providers and fill data from data from data adapter to a Data Grid control.

App Settings("Str Connection" )) dim obj Cmd As New Ole Db Command() Dim obj Param As Ole Db Parameter With obj Cmd .

Contribution " & _ "FROM tbl Pub Author " & _ "WHERE (((tbl Pub Author.

To update the database you need to create the Insert, Update and Delete commands of the data adapter.

Data Bind() When you create the new data adapter, the select statement of the adapter is automatically created for you.

The Sql Data Adapter uses the Connection object of the .

The Insert Command , the Update Command , and the Delete Command properties of the Sql Data Adapter Object update the database with the data modifications, that are run on a Data Set object.

updating datasource using dataadapter-65

Registration is fast, simple and absolutely free .) to update my msaccess db. Value = pub ID Try my Adapter = New Oledb Data Adapter(obj Cmd) add Scema() my Adapter. Close() end try end sub sub update Child() dt Pub Table = c Type(view State("pub Table"),datatable) dt Pub Table. Columns.remove("Pub Role") dim str SQL as string = "SELECT tbl Pub Author.

Next set the properties to Ole Db Data Adapter and SQL Data Adapter.

After setting these properties, the form will look like figure 5-40.

As you can see, there are two buttons, Ole Db Data Adapter and SQL Data Adapter.

Now add button-click event handlers for both the Ole Db Data Adapter and SQL Data Adapter buttons.

Leave a Reply