RDO, SQL Server & Stored Procedures 
Author Message
 RDO, SQL Server & Stored Procedures

Quote:

> I plan to standardize on RDO to access SQL Server for this application
> I'm developing.

> I'm also using a third party grid and binding it to RDO resultsets.

> There are some database updates and I tried to use stored procedures but
> I'm having difficulties passing & receiving parameters to/from the
> stored procedures using the Execute method of the RDO Connection &
> PreparedStatement objects.

> At worst, I can execute SQL statements directly from the Connection and
> PreparedStatement objects but I understand that better performance can
> be obtained from using stored procedures.

> The books and online documentation that I have looked at only have VBSQL
> examples.  Am I right to assume that that is the preferred way to
> execute stored procedures from VB?

> Help much appreciated.

> Chris
> --
> Chris Seah                                                (65) 774 8654
> Information Frontiers Private Limited (Singapore)
> http://www.*-*-*.com/

Don'y know if this is what you want..

dim gdb as rdoconnection
dim sp as rdoPreparedStatement
Set gdb = rdoEnvironments(0).OpenConnection("ODBCSOURCE",
rdDriverCompleteRequired, False, "")
Set sp = gdb.CreatePreparedStatement("", "{Call
StoredProcedure(?,?,?,?,?)}")

sp.rdoParameters(0) = value
sp.rdoParameters(1) = value
sp.rdoParameters(2) = value
sp.rdoParameters(3) = value
sp.rdoParameters(4) = value

sp.Execute

Alex



Sun, 18 Jul 1999 03:00:00 GMT  
 RDO, SQL Server & Stored Procedures

I plan to standardize on RDO to access SQL Server for this application
I'm developing.

I'm also using a third party grid and binding it to RDO resultsets.

There are some database updates and I tried to use stored procedures but
I'm having difficulties passing & receiving parameters to/from the
stored procedures using the Execute method of the RDO Connection &
PreparedStatement objects.

At worst, I can execute SQL statements directly from the Connection and
PreparedStatement objects but I understand that better performance can
be obtained from using stored procedures.

The books and online documentation that I have looked at only have VBSQL
examples.  Am I right to assume that that is the preferred way to
execute stored procedures from VB?

Help much appreciated.

Chris
--
Chris Seah                                                (65) 774 8654
Information Frontiers Private Limited (Singapore)
http://www.infront.com.sg



Mon, 19 Jul 1999 03:00:00 GMT  
 RDO, SQL Server & Stored Procedures

Try reading William Vaughn's Hitchhiker's Guide to Visual Basic and SQL
Server.  It goes over the four basic methods of accessing SQL Server with
VB, including rdo, using stored procedures, etc.



Quote:
> I plan to standardize on RDO to access SQL Server for this application
> I'm developing.

> I'm also using a third party grid and binding it to RDO resultsets.

> There are some database updates and I tried to use stored procedures but
> I'm having difficulties passing & receiving parameters to/from the
> stored procedures using the Execute method of the RDO Connection &
> PreparedStatement objects.

> At worst, I can execute SQL statements directly from the Connection and
> PreparedStatement objects but I understand that better performance can
> be obtained from using stored procedures.

> The books and online documentation that I have looked at only have VBSQL
> examples.  Am I right to assume that that is the preferred way to
> execute stored procedures from VB?

> Help much appreciated.

> Chris
> --
> Chris Seah                                                (65) 774 8654
> Information Frontiers Private Limited (Singapore)
> http://www.infront.com.sg



Mon, 19 Jul 1999 03:00:00 GMT  
 RDO, SQL Server & Stored Procedures

Chris, for returned values you will need to set the direction property of
the rdoParameter as a return value prior to executing the stored procedure.
 (from the VB4 Help file)

Dim my_statement As rdoPreparedStatement
Set my_statement = someRdoConnection.CreatePreparedStatement _
        ("MyPs", "{?=call sp_testprocedure }", ...)
my_statement.rdoParameters(0).Direction = rdParamOutput
my_statement.Execute
Print my_statement.rdoParameters(0).Value



Quote:

> > Don'y know if this is what you want..

> > dim gdb as rdoconnection
> > dim sp as rdoPreparedStatement
> > Set gdb = rdoEnvironments(0).OpenConnection("ODBCSOURCE",
> > rdDriverCompleteRequired, False, "")
> > Set sp = gdb.CreatePreparedStatement("", "{Call
> > StoredProcedure(?,?,?,?,?)}")

> > sp.rdoParameters(0) = value
> > sp.rdoParameters(1) = value
> > sp.rdoParameters(2) = value
> > sp.rdoParameters(3) = value
> > sp.rdoParameters(4) = value

> > sp.Execute

> > Alex

> Alex,

> Thanks for the tip.  Yes, I tried the above and had limited success.  I
> am able to pass parameters *to* the procedure but can't seem to get it
> right when I need the value to be returned to VB.

> e.g with the stored procedure below



> return

> And in VB, this is how I call it :

> Set ps = gdb.CreatePreparedStatement("", "Execute sp_GetOrderNo ?")
> ps.rdoParameters(0) = OrderNo
> ps.Execute

> The program executes OK (no runtime error) but OrderNo always contains
> the wrong value. (in my case, 0)

> --
> Chris Seah                                                (65) 774 8654
> Information Frontiers Private Limited (Singapore)
> http://www.infront.com.sg



Tue, 20 Jul 1999 03:00:00 GMT  
 RDO, SQL Server & Stored Procedures

Quote:

> Don'y know if this is what you want..

> dim gdb as rdoconnection
> dim sp as rdoPreparedStatement
> Set gdb = rdoEnvironments(0).OpenConnection("ODBCSOURCE",
> rdDriverCompleteRequired, False, "")
> Set sp = gdb.CreatePreparedStatement("", "{Call
> StoredProcedure(?,?,?,?,?)}")

> sp.rdoParameters(0) = value
> sp.rdoParameters(1) = value
> sp.rdoParameters(2) = value
> sp.rdoParameters(3) = value
> sp.rdoParameters(4) = value

> sp.Execute

> Alex

Alex,

Thanks for the tip.  Yes, I tried the above and had limited success.  I
am able to pass parameters *to* the procedure but can't seem to get it
right when I need the value to be returned to VB.

e.g with the stored procedure below



return

And in VB, this is how I call it :

Set ps = gdb.CreatePreparedStatement("", "Execute sp_GetOrderNo ?")
ps.rdoParameters(0) = OrderNo
ps.Execute

The program executes OK (no runtime error) but OrderNo always contains
the wrong value. (in my case, 0)

--
Chris Seah                                                (65) 774 8654
Information Frontiers Private Limited (Singapore)
http://www.infront.com.sg



Tue, 20 Jul 1999 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. RDO, SQL Server & Stored Procedures

2. VB4 RDO Won't detect an error in an SQL Server 6.0 stored procedure

3. MS SQL Server BLOBS, RDO and Stored Procedures

4. RDO and SQL Server stored procedure problems

5. Converting dynamic query by example SQL to RDO based SQL Stored Procedure

6. CR OCX 4.6 & SQL Server stored procedures

7. VB 5.0 & Stored Procedure (SQL Server 6.5)

8. doing updating from grid to sql server with stored procedure sql 2000

9. RDO & Stored Procedures Benchmarking

10. Problems with RDO & Stored Procedures

11. RDO 2.0 and calling Oracle PL/SQL Stored Procedures

12. SQL Server 7 stored procedures

 

 
Powered by phpBB® Forum Software