Hello everyone,
i have the parameter in my stored procedure that i am using as a sqldatasource.
Now in one of the events, i need to assign a value to the parameter. How can i do that?
Microsoft is changing the syntax so often, all solutions i found on this forum just don't work anymore, like:
SqlDataSource1.SelectParameters[
"@.CompareInteger"].value="1"OR
SqlDataSource1.SelectParameters["@.CompareInteger"].DefaultValue="1"
I guess the SelectParameter - became 'ReadOnly'..But how to assign value to a parameter now?!?
Thanks for any help
They aren't changing the syntax.. Hasn't ever changed, but those methods you mentioned above only work in certain circumstances, because they are "hacks".
What you want to do is capture the SqlDataSource1_Selecting event. From within that event, you have access to the underlying command (and parameters collection). Your code from within that event would looks something like:
e.Parameters["@.CompareInteger"].Value="1;
Or
e.parameters("@.compareinteger").value="1" if you are using VB.NET
|||it does not work, Motley. It does not work.
for SqlDataSource1_Selecting event, e does not have such an option - e.parameters - check it for yourself...:(
So, the question still remains - HOW TO ASSIGN VALUE TO A PARAMETER?
|||IS there any way to assign the value to a parameter?!?!? in any event procedure?|||If it's not e.parameters, then it's one of the following:
e.SelectCommand.Parameters
or
e.Command.Parameters
|||thank you, Motley ! Will remember it now.
No comments:
Post a Comment