To call a stored procedure:
| Methods | Description |
<StoredProcedureCodeName>Command(<stored procedure parameters>) |
Creates a command object that can be used to call the wrapped stored procedure. |
|
Invokes the wrapped stored procedure and returns output data in a DataTable object. |
For example:
using(MyDatabase db = new MyDatabase())
{
// Call the GetUsersByZip stored
procedure and return data in a DataTable object
DataTable users =
db.StoredProcedures.GetUsersByZipDataTable(77057);
// You do not need to close the DB
connection manually.
// The using statement does it automatically.
}
MyDatabase db = new MyDatabase();
try
{
// Call the GetUsersByZip
stored procedure and return data in a DataTable object
DataTable users =
db.StoredProcedures.GetUsersByZipDataTable(77057);
}
finally
{
// Do not forget to close the DB connection
db.Close();
}
Dim db As New MyDatabase()
Try
' Call the GetUsersByZip stored
procedure and return data in a DataTable object
Dim users As DataTable =
db.StoredProcedures.GetUsersByZipDataTable(77057)
Finally
' Do not forget to close the DB connection
db.Close()
End Try