Inserting Data

To insert a record into the table:

For example:

[C#]

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.

}

or

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();
}

VB.NET

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