ASP.NET SqlDataSource parameter declaration in code behind
I'm implementing SqlDataSource in code behind. Here is my code:
var sqlDataSource = new SqlDataSource
{
ConnectionString = _constr,
SelectCo开发者_如何转开发mmand =
"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.
try this
sqlDataSource.SelectParameters.Add(new Parameter("One", System.TypeCode.Int32, recordNo))
精彩评论