ADO Connection, Command, Recordset, and Parameter Object Example

Category:
Database
Type:
Snippets
Difficulty:
Beginning

Author: PB

Version Compatibility: Visual Basic 6, Visual Basic 5

More information:
This is a small example on how to extract the recordset by executing a stored procedure using command object of ADO. It demonstrates the major objects of ADO (connection, command, parameter, and recordset) and is therefore good for beginners to use as a starting point.

The example is based on a stored procedure in a SQL Server database. The procedure is as follows:

Procedure GetRecords

@rowC int output,
@statement varchar(50) output

As

select * from exe /*You can use any table which is present in the database*/

set @rowC=@@rowcount
set @statement='hey good work..buddy'

return

For more, information visit: http://www.geocities.com/priyadarshu

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: