H
Harry
Hi,
Could someone tell me where I am going wrong here.
I am filling a datagrid from a SQL database using SqlDataReader.
For the query, I want to use a variable coming from the URL.
Code snippet as follows:
SqlDataAdapter objDataAdapter = new SqlDataAdapter("SELECT CaseCode,
CaseName, @PriceCol, image_thumb FROM dbo.tblCases", myConnection);
objDataAdapter.SelectCommand.Parameters.Add(new
SqlParameter("@PriceCol",SqlDbType.VarChar,50)).Value =
Request.QueryString["Range"];
DataSet dsCases = new DataSet();
objDataAdapter.Fill(dsCases, "CaseName");
dgListCases.DataSource = dsCases.Tables["CaseName"].DefaultView;
dgListCases.DataBind();
myConnection.Close();
*************
When I use this, all I get in the column for "Price" is the actual URL
variable rather than the values from the database.
Can anyone see what I am doing wrong?
Thanks and Thanks and Thanks Again
H
Could someone tell me where I am going wrong here.
I am filling a datagrid from a SQL database using SqlDataReader.
For the query, I want to use a variable coming from the URL.
Code snippet as follows:
SqlDataAdapter objDataAdapter = new SqlDataAdapter("SELECT CaseCode,
CaseName, @PriceCol, image_thumb FROM dbo.tblCases", myConnection);
objDataAdapter.SelectCommand.Parameters.Add(new
SqlParameter("@PriceCol",SqlDbType.VarChar,50)).Value =
Request.QueryString["Range"];
DataSet dsCases = new DataSet();
objDataAdapter.Fill(dsCases, "CaseName");
dgListCases.DataSource = dsCases.Tables["CaseName"].DefaultView;
dgListCases.DataBind();
myConnection.Close();
*************
When I use this, all I get in the column for "Price" is the actual URL
variable rather than the values from the database.
Can anyone see what I am doing wrong?
Thanks and Thanks and Thanks Again
H