Stored Procedure with Parameter
The ADO.NET classes can be categorized into two main components: Data Providers and DataSet. Data Providers are responsible for establishing connections with databases, executing commands, and retrieving data results. They serve as the bridge between the application and the underlying database. On the other hand, the DataSet is an in-memory representation of data retrieved from a database, providing a disconnected and versatile data manipulation environment.
Within ADO.NET, the Command object plays a significant role in executing SQL queries. It offers a variety of Execute methods, enabling developers to perform SQL queries in different ways. These methods allow for flexibility in executing queries and retrieving results from the database.
Stored Procedure
A Stored Procedure is a collection of programming statements that perform operations within a database. They can encompass various tasks, including calling other procedures. Stored procedures often accept input parameters, which can be supplied when executing the procedure. Additionally, they can return multiple values, offering a convenient means of retrieving data or executing complex operations within the database.A sample stored procedure with accepting input parameter is given below :
The above stored procedure is accepting a country name (@COUNTRY VARCHAR(20)) as parameter and return all the publishers from the input country. Once the CommandType is set to StoredProcedure, you can use the Parameters collection to define parameters.
The above code passing country parameter to the stored procedure from vb.net.
Full Source VB.NET- ADO.NET Connection Object
- ADO.NET SQL Server Connection
- ADO.NET OLEDB Connection
- ADO.NET ODBC Connection
- ADO.NET Command
- ADO.NET ExecuteNonQuery in SqlCommand Object
- ADO.NET ExecuteNonQuery in OleDbCommand Object
- ADO.NET ExecuteScalar in SqlCommand Object
- ADO.NET ExecuteScalar in OleDbCommand Object
- ADO.NET ExecuteReader in SqlCommand Object
- ADO.NET ExecuteReader in OleDbCommand Object
- How to ADO.NET DataReader
- How to ADO.NET SqlDataReader
- How to ADO.NET OleDbDataReader
- How to Multiple Result Sets in ADO.NET
- Getting Schema Informations from SqlDataReader
- Getting Schema Informations from OleDbDataReader
- What is DataAdapter
- What is SqlDataAdapter
- What is OleDbDataAdapter
- Vb.NET ExecuteReader and ExecuteNonQuery