I prefer to specify the parameter type to ensure type-casting is done
correctly particularly when the value might be affected by the Culture
setting of the server running the application. e.g.
ObjectDataSource1.SelectParameters.Add(New
WebControls.Parameter("OrderDate", TypeCode.DateTime, Now.ToString()))
--
HTH,
Phillip Williams
http://www.societopia.net http://www.webswapp.com
"Robert" wrote:
Thanks for the reply. I have a follow-up question:
Should I use the Default Value or add the parameter for best practice?
1) ObjectDataSource1.SelectParameters("LastNam").Defa ultValue="Doe"
2) ObjectDataSource1.SelectParameters.Add("LastName", "Doe")
"Phillip Williams" wrote:
The DefaultValue is the correct way to set such parameters at run-time.
(There is no databound value to replace it)
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Robert" wrote:
What is the best way to pass a parameter to an ObjectDataSource.
I am able to add a new parameter to the SelectParameters, but I would like
to just assign a value to an existing parmeter at runtime.
Currently I am just adding the parameter at runtime and setting the value:
ObjectDataSource1.SelectParameters.Add("searchCCN" , "")
I would like to accomplish the following:
ObjectDataSource1.SelectParameters.("LastName") = "Doe"
The code above does not work. There is no parameter.value, only
parameter.DefaultValue. Is there a better way to set an existing parameter
value in an ObjectDataSource?
Thanks,