Monday, December 24, 2007

Passing parameters to SqlDataSource at run-time in order to excute stored procedures

.Net framework allows creating SqlDataSources to execute stored procedures. The following is how to pass values to it if the stored procedure is parametrized:

When creating SQL data source, choose None on Parameter Source drop-down list located on configuration data source wizard and add the following code to your code-behind.

MySqlDataSource.SelectParameters["SPParameterName"].DefaultValue = "Value";

No comments: