VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Undocumented Trick for calling stored procedures in vb using ADO

by Sheraze S (1 Submission)
Category: Databases/Data Access/DAO/ADO
Compatability: Visual Basic 3.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (3 Votes)

Undocumented Trick for calling stored procedures in vb using ADO

Rate Undocumented Trick for calling stored procedures in vb using ADO





There is an undocumented Trick for calling stored procedures in vb using ado


There is an undocumented shortcut for calling stored procedures in vb using ado.


 


We normally call stored Procedures using the following


 


1)command object.


2)recordset object's open method.


3)connection object's execute method.


 


Here are a Few Examples of the undocumented way to call stored procedures using vb and ado:


1)a simple example without input parameters or return recordsets.


Stored Procedure:


Create proc p1


as


select * into copy1 from authors


VB Call


Dim cn As New ADODB.Connection


Dim rs As New ADODB.Recordset


cn.Open "driver=sql server;server=sheraze\sheraze;"


cn.p1 


'u wont get all the stored procedure names at design time.


2)this sample takes an input parameter and returns a recordset 


Stored Procedure:


Create proc p2 (@name varchar(10))


as


select * from authors where au_lname = @name


VB Call


Dim cn As New ADODB.Connection


Dim rs As New ADODB.Recordset


cn.Open "driver=sql server;server=sheraze\sheraze;database=pubs"


cn.p2 "white", rs 


'u wont get all the stored procedure names at design time.


 


 


 


 


 


 


 


 


 


 


-sheraze



Download this snippet    Add to My Saved Code

Undocumented Trick for calling stored procedures in vb using ADO Comments

No comments have been posted about Undocumented Trick for calling stored procedures in vb using ADO. Why not be the first to post a comment about Undocumented Trick for calling stored procedures in vb using ADO.

Post your comment

Subject:
Message:
0/1000 characters