Click here to Skip to main content
15,921,210 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
hiii all,
i m anil. i am new in asp.net .. my problem is that i fatch barcode and distt from hyperlink click in query string. and i want to use this query string values in sql store procedure to fatch data accroding to condition.
please give me ans with detail..

thanks in advance..
Posted
Comments
CHill60 1-Mar-14 7:26am    
Can you use the green "Improve question" link to do 2 things? 1. Post the code that you have tried so far and 2. Try to explain your problem a little better.

hope it will help u,

int RecID = Convert.ToInt32(Request.QueryString["RecID"]);
int EMPID = Convert.ToInt32(Request.QueryString["EMPID"]);

SqlParameter[] Params = new SqlParameter[2];
Params[0] = new SqlParameter("@EmpID", EMPID);
Params[1] = new SqlParameter("@PaySlipID", RecID);
DataTable dt = new DataTable();
dt = dl.GetDataWithParameters("Sp_GetPaySlip", Params);
 
Share this answer
 
Comments
bindash 3-Mar-14 1:37am    
what is dl in ur code
abdul subhan mohammed 3-Mar-14 3:07am    
dl is the DataAccessLayer.cs, where i'm creating its instance, like:
DAL dl = new DAL();
to call getDatewithParameters()... etc
abdul subhan mohammed 3-Mar-14 3:07am    
public DataTable GetDataWithParameters(string StoredProcedureName, SqlParameter[] Param)
{
SqlConnection conn = null;
try
{
DataTable tb = null;
conn = new SqlConnection(GetConnectionString());
DataSet ds = SqlHelper.ExecuteDataset(conn, CommandType.StoredProcedure, StoredProcedureName, Param);
tb = ds.Tables[0];
return tb;
}
catch (Exception)
{
throw;
}
finally
{
conn.Close();
}

}
I'm assuming that you've given query string values like following,
C#
string code = Request.QueryString["barcode"];
string distt = Requset.QueryString["distt"];
string query = "select * from SomeTable where barcode= '" + code +", distt = '" + distt "'";
// and do rest of the stuff...

-KR
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900