To retrieve data from a table:
| Methods | Description |
GetAll |
Gets an array of all records from the table. |
GetAllAsDataTable |
Gets a System.Data.DataTable object that includes all records from the table. |
GetAsArray |
Gets an array of row objects that match the search condition, in the the specified sort order. |
GetAsDataTable |
Gets a System.Data.DataTable object filled with data that match the search condition, in the the specified sort order. |
GetBy<ForeignKeyColumnName> |
Gets an array of row objects by a foreign key. |
GetBy<ForeignKeyColumnName>AsDataTable |
Gets a System.Data.DataTable object by a foreign key. |
GetByPrimaryKey |
Gets a record by the primary key. |
using(MyDatabase db = new
MyDatabase())
{
// Get all rows from the User table
UserRow[] users =
db.UserCollection.GetAll();
// Get a row from the User table using the
primary key values
UserRow user =
db.UserCollection.GetByPrimaryKey("John", "Smith");
// You do not need to close the DB
connection manually.
// The using statement does it automatically.
}
MyDatabase db = new MyDatabase();
try
{
// Get all rows from the User table
UserRow[] users =
db.UserCollection.GetAll();
// Get a row from the User table using the
primary key values.
UserRow user =
db.UserCollection.GetByPrimaryKey("John",
"Smith");
}
finally
{
// Do not forget to close the DB connection
db.Close();
}
Dim db As New MyDatabase()
Try
' Get all rows from the User table
Dim users As
UserRow() = db.UserCollection.GetAll()
' Get a row from the User table using the
primary key values.
Dim user As UserRow =
db.UserCollection.GetByPrimaryKey("John", "Smith")
Finally
' Do not forget to close the DB connection
db.Close()
End Try