Adding ADO.NET Parameters
Under the covers, the SqlDataSource
control uses ADO.NET objects such as the ADO.NET DataSet
, DataReader
, Parameter
, and Command
objects to interact with a database. In particular, any ASP.NET Parameter
objects that you declare when working with the SqlDataSource
control get converted into ADO.NET Parameter
objects.
In some cases, you want to work directly with these ADO.NET Parameter
objects when using the SqlDataSource
control. For example, you might want to add additional ADO.NET parameters programmatically before executing a command.
The page in Listing 9.26 automatically adds an ADO.NET Parameter
that represents the current user’s username to the command that the SqlDataSource
executes.
Listing 9.26. AddParameter.aspx ...
Get ASP.NET 4 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.