Repeat the above steps to update the address of the
customers. Select “Update” option in step 3, provide a method name in the next
step and give the following query that will update the address, city, region,
postalcode, country, phone and fax by giving the customerid.
The update query will be:
SET [Address] = @Address,
[City] = @City,
[Region] = @Region,
[PostalCode] = @PostalCode,
[Country] = @Country,
[Phone] = @Phone,
[Fax] = @Fax
WHERE (([CustomerID] = @Original_CustomerID)) .
So our final dataset in designer will look like:
Figure 10 – Final Customer table view
How to use the functionality?
To execute the above functionality instantiate the Table
Listing 5: Instantiating TableAdapter
TestTableAdapters.CustomersTableAdapter ada = new
Now we can see the new select and update functionality with
the insert, update and delete method in TableAdapter intellisense.
Figure 11 – Visual studio intellisense for
We can use the above functionality:
Listing 6: Using the new functionality
ada.UpdateAddress("2nd Cross", "Bangalore", "Karnataka", "560061",
"India", "123456789", "!23456789", "100");
//Get details by customerid
grdCustomers.DataSource = ada.GetDataBy("100");
In the next section we will construct a custom typed dataset
using visual studio instead of dragging and dropping from server explorer.