I answered for a question at Topcoder.com : http://toostep.com/question/stored-procedure?extraAction=fv
Posting the same answer here :
you can use SQLHelper which is a standard helper file provided by microsoft
and which will be very much useful for using it in the Data logic layer of all ur .net applications.
code will be like this :
include this sqlhelper.cs : http://www.koders.com/csharp/fidD4121D6E4BCA2DAB656D770903FECBFF7427D242.aspx?s=mdef%3Ainsert
to your solution :
using Helper.SQLHelper;
SqlParameter[] Param = new SqlParameter[2];
Param[0] = new SqlParameter("@number", objBLL.nNo);
Param[1] = new SqlParameter("@name", objBLL.strname);
DataSet dsstudentdetails = new DataSet();
dsstudentdetails = SqlHelper.ExecuteDataset(strSQLConnectionString, CommandType.StoredProcedure, "Getstudentdetails", Param);
if (dsstudentdetails.Tables.Count > 0)
{
return dsstudentdetails;
}
else
{
return dsstudentdetails;
}
here objbll is the business logic layer object for which u can pass data from ur presentation layer and the total bll is passed to the function
No comments:
Post a Comment