Parameters and Stored Procedures

We have covered the basics of using ADO.NET in a connected scenario. We have seen that by using the appropriate interfaces, we can write database code that is relatively independent of the data source. We are now going to begin to examine some additional features, where there may be differences among data sources. For example, we will look at the use of stored procedures. For the rest of this chapter we will focus on the SQL Server database.

Sometimes you have to parameterize a SQL statement. You also might have to associate the input and output arguments of a stored procedure with variables in your program.

To do this you build the SqlCommand class's Parameters property, which is a collection of SqlParameter ...

Get Application Development Using Visual Basic® and .NET 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.