HOWTO: Call SQL Server System Stored Procedures from RDOLast reviewed: November 26, 1997Article ID: Q166211 |
The information in this article applies to:
SUMMARYThis article describes how to call system-stored procedures on SQL Server from RDO. SQL Server has a number of prewritten, stored procedures that are used to configure and administer the SQL server. They are all located in the Master database and have the prefix “sp_,” which distinguishes them from user- or application-written stored procedures. In order to call these stored procedures from RDO, you must specify the correct database in which they reside, the master database. There are several ways to do this, but the most effective way is to explicitly reference the stored procedure in your call syntax. For example:
{ ? = call master.dbo.sp_addlogin(?,?) }Another method to accomplish this behavior is to set the default database before creating and executing your stored procedure. The following example uses a prepared statement and assumes that "Pubs" is your default database, cn is an active rdoConnection object, and qr is an rdoQuery object:
cn .Execute "Use Master" qr.SQL = "some sql to execute..." Set qr.ActiveConnection = cn qr .Execute cn .Execute "Use Pubs" MORE INFORMATION
REFERENCESIn Visual Basic Books Online, please see:
Guide to Building Client Server Applications in Visual Basic (Enterprise) Part 3: Data Access Options Using Remote Data Objects and the Remote Data Control Using RDO to Execute Stored Procedures(c) Microsoft Corporation 1997, All Rights Reserved. Contributions by Jon Fowler, Microsoft Corporation Keywords : vb432 VB4WIN vb5all vb5howto VBKBDB VBKBNet VBKBObj kbusage kbhowto Version : 5.0 Platform : WINDOWS Issue type : kbhowto |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |