To insert a record into the table:
Insert
method passing a row object.
For example:
using(MyDatabase db = new MyDatabase())
{
// Create new row object
UserRow user = new UserRow();
user.FirstName = "John";
user.LastName = "Smith";
user.City = "Houston";
// Insert the object into the User table
db.UserCollection.Insert(user);
// You do not need to close the DB
connection manually.
// The using statement does it automatically.
}
MyDatabase db = new MyDatabase();
try
{
// Create new row object
UserRow user = new UserRow();
user.FirstName = "John";
user.LastName = "Smith";
user.City = "Houston";
// Insert the object into the User table
db.UserCollection.Insert(user);
}
finally
{
// Do not forget to close the DB
connection
db.Close();
}
Dim db As New MyDatabase()
Try
' Create new row object
Dim user As
UserRow = New UserRow()
user.FirstName = "John"
user.LastName = "Smith"
user.City = "Houston"
' Insert the object into the User table
db.UserCollection.Insert(user)
Finally
' Do not forget to close the DB
connection
db.Close()
End Try