Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Calling a sql server stored procs

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-12-31 : 09:54:36
Ujjal writes "How can I call a sql server stored procs from a VB. The stored procs does not return any record set. I have some select statement inside the stored procs. I want to show the records fetched by that select stmt inside vb code. How to do it?"

Nazim
A custom title

1408 Posts

Posted - 2001-12-31 : 10:31:19
have a ADODB connection

dim conn as new ADODB.Connection
dim rs as new ADODB.Recordset
conn.open(connectionstring)

set rs=conn.execute ("Exec stopredprocedure")

should do it.

HTH





Edited by - Nazim on 12/31/2001 10:34:51
Go to Top of Page

Onamuji
Aged Yak Warrior

504 Posts

Posted - 2001-12-31 : 14:29:49
quote:
The stored procs does not return any record set. I want to show the records fetched by that select stmt ...


Other than your false statement above here's another way to execute a procedure. In ADO the connection object makes functions for each stored procedure in the database it connects to. Well it doesn't really make them it uses something called a Vtable lookup and such fun stuff but it works... oh the functions take all the parameters of the stored procedure and an optional last parameter that is the recordset to return the data in.

Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cn = New ADODB.Connection
cn.Open CONNECTION_STRING
cn.StoredProcedureName rs


- Onamuji
Go to Top of Page

Nazim
A custom title

1408 Posts

Posted - 2001-12-31 : 14:56:01
Happy New Year Every1 there,

a small edition is required on my previous post

dim conn as new ADODB.Connection
dim rs as new ADODB.Recordset
conn.open connectionstring

set rs=conn.execute ("Exec stopredprocedure " & param1 &)

Onamji, thanx i never realized that there was something specifically for storedprocedure in connection object. Does it Speeds up the performance or it is just for ease of use.


Go to Top of Page
   

- Advertisement -