I'm implementing SqlDataSource in code behind. Here is my code:
var sqlDataSource = new SqlDataSource
{
ConnectionString = _constr,
SelectCommand =
"SELECT One, Two FROM Foo WHERE (One = @One) AND (Two = @Two)"
};
How to declare parameters and attribute them values in code behind? I've tried to do something like this: sqlDataSource.SelectParameteres.Add("@One", "value"); etc. but it thrown execute scalar error.
尝试这个
sqlDataSource.SelectParameters.Add(new Parameter("One", System.TypeCode.Int32, recordNo))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.