Stored Procedures in VB.NET
The data provider is a set of components that include the Connection, Command, DataReader, and DataAdapter Objects. The command Object provides a number of Execute methods that can be used to perform the SQL queries in a variety of fashions.
A stored procedure is a precompiled executable object that contains one or more SQL statements. A sample Stored Procedure is given below :
CREATE PROCEDURE SPPUBLISHER AS SELECT PUB_NAME FROM publishers
The above code create a procedure named as 'SPPUBLISHER' and it execute SQL statement that select all publisher name from publishers table from the PUB database.
Using stored procedures, database operations can be encapsulated in a single command, optimized for best performance, and enhanced with additional security. To call a stored procedure from VB.NET application, set the CommandType of the Command object to StoredProcedure.
command.CommandType = CommandType.StoredProcedure
From the following source code you can see how to call a stored procedure from VB.NET application.
- 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