Busy for two months did not write things, today we share some work results.
A common way to execute stored procedures
///<summary>
/ Executes the stored procedure, returning a dataset.
///</summary>
///<param name= "Procdure" ></PARAM>
///<param Name= "Para" ></PARAM>
///<returns></returns>
Public DataSet exeprocedure (string procdure, string[] para)
{
da = New SqlDataAdapter ();
comm = new SqlCommand (procdure, con.conn);
comm.commandtype = CommandType.StoredProcedure;
for (int i = 0; i < para. Length; i++)
{
string text = Para[i]. ToString ();
i++;
String value = Para[i]. ToString ();
Parameters = new SqlParameter (text, value);
Comm. Parameters.Add (Parameters);
}
Da. SelectCommand = comm;
ds = new DataSet ();
Try
{
Da. Fill (DS);
}
catch (System.Exception ex)
{
Closelink ();
}
Closelink ();
return DS;
}
The variables and values in the stored procedure are placed in the array in the following format:
Strpara[0] = "@BeginDate";
STRPARA[1] = Begindt;
STRPARA[2] = "@EndDate";
STRPARA[3] = ENDDT;