0

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.

1 Answer 1

3

try this

sqlDataSource.SelectParameters.Add(new Parameter("One", System.TypeCode.Int32, recordNo))
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.