开发者

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))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜