To update data in a table:
Update
methods.
| Methods | Description |
Update(<TableCodeName>Row row) |
Updates a record in the table. |
Update(System.Data.DataTable table) |
Updates the table. |
For example:
using(MyDatabase db = new MyDatabase())
{
// Get a row from the User table using the
primary key values
UserRow user =
db.UserCollection.GetByPrimaryKey("John",
"Smith");
// Change some of the row properties
user.City = "Dallas";
// Update data in the User table
db.UserCollection.Update(user);
// You do not need to close the DB
connection manually.
// The using statement does it automatically.
}
MyDatabase db = new MyDatabase();
try
{
// Get a row from the User table using the
primary key values
UserRow user = db.UserCollection.GetByPrimaryKey("John",
"Smith");
// Change some of the row properties
user.City = "Dallas";
// Update data in the User table
db.UserCollection.Update(user);
}
finally
{
// Do not forget to close the DB connection
db.Close();
}
Dim db As New MyDatabase()
Try
' Get a row from the User table using the
primary key values
Dim user As
UserRow = db.UserCollection.GetByPrimaryKey("John", "Smith")
' Change some of the row properties
user.City = "Dallas"
' Update data in the User table
db.UserCollection.Update(user)
Finally
' Do not forget to close the DB connection
db.Close()
End Try