staticprivatestring
GetDocumentSummary(int
documentID)
{ //Assumes GetConnectionString returns a valid connection string. using
(SqlConnection connection = new
SqlConnection(GetConnectionString()))
{
connection.Open();
SqlCommand command = connection.CreateCommand(); try
{ // Setup the command to execute the stored procedure.
command.CommandText = "GetDocumentSummary"
;
command.CommandType = CommandType.StoredProcedure;
// Set up the input parameter for the DocumentID.
SqlParameter paramID = new
SqlParameter("@DocumentID"
, SqlDbType.Int);
paramID.Value = documentID;
command.Parameters.Add(paramID);
// Set up the output parameter to retrieve the summary. SqlParameter paramSummary = new
SqlParameter("@DocumentSummary"
,
SqlDbType.NVarChar, -1);
paramSummary.Direction = ParameterDirection.Output;
command.Parameters.Add(paramSummary);