My code is not working. @X is my parameter ans ASP.NET shows error near @X parameter.
Please help.
SqlCommand cmd = new SqlCommand("SELECT top @x * FROM tblname",cn);
cmd.Parameters.AddWithValue("@x",DropDown1.SelectedItem.value);
SqlDataReader dr;
dr=cmd.executeReader();
DataList1.DataSource = dr;
DataList1.DataBind();
Just change
SELECTstatement this way:I only includes the brackets around
@xparameter