Free Newsletters:
DatabaseJournal  
DBANews
Database Journal
Search Database Journal:
 
MS SQL Oracle DB2 Access MySQL PostgreSQL PHP SQL Etc SQL Scripts & Samples Links Database Forum DBA Videos
internet.com

» Database Journal Home
» Database News
» DBA Videos
» Database Articles
» Database Tutorials
MS SQL
Oracle
MS Access
MySQL
DB2
» RESOURCES
Database Tools
SQL Scripts & Samples
Links
» Database Forum
» DBA Jobs
» Sitemap

News Via RSS Feed



follow us on Twitter

Marketplace Partners
Be a Marketplace Partner




internet.commerce
Be a Commerce Partner


















FCC's Martin: Open Networks Becoming the Norm

Enterprise SaaS Buyers Want More Than Uptime

Cuban Waves Off SEC Allegations

internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Database Journal | DBA Support | SQLCourse | SQLCourse2 | Swynk







Content Coordinator
Aquent
US-WA-Redmond

Justtechjobs.com Post A Job | Post A Resume
October 9, 2000

Utility to Build VB Class to Match SQL Stored Procedures

By Danny Lesandrini


Utility Output for SP ems_GetNextCounters

Here is a screen shot of the form that displays the results.
(The full text of the code follows.)



Click to Enlarge


Option Explicit


' ----- BEGIN ASP/ADO CODE USE EXAMPLE FOR THIS CLASS-----
'
'  This code may be tweaked and pasted into your ASP Page to instantiate
'  the class that calls your Stored Proc.
'  You will need to change the names of the DLL, Class and functions as 
'  well as the parameters for the connection string.
'
'
'    Dim objDataCls
'    Dim rstReturn
'    Dim sConnect
'    Dim lRecCount
'    Dim sError

'    Set objDataClass = Server.CreateObject("YourDLL.YourClass")
'    Set rstReturn = Server.CreateObject("ADODB.Recordset")
'    sConnect = "Provider=SQLOLEDB.1;User ID=sa;PWD=;Initial Catalog=YourDB;Data Source=YourServer"
'    Set rstReturn = objDataCls.Exec_ems_MyProc(sConnect, Param_1, ... Param_n)
'
'    lRecCount = objDataCls.RecordsAffected
'    sError = objDataCls.SQLError
'
'    If Not rstReturn.BOF Then
'        Do Until rstReturn.EOF ...
'
' ------------------- END CODE SAMPLE ------------------- 


Private lngRecordsAffected As Long
Private strSQL7Error As String

Property Get RecordsAffected() As String
    RecordsAffected = lngRecordsAffected
End Property

Property Get SQLError() As String
    SQLError = strSQL7Error
End Property



'//////////// Code for:  ems_GetNextCounters ////////////
'  Created on 10/6/2000
'  Created by Danny Lesandrini
'  Created for Dean Evans and Associates, Inc.
'
'  Parameters expected by this Stored Proc
'  ----------------------------------------
'    @TableName varchar(75)
'    @HowMany int
'    @NextCounter int OUTPUT
'  ----------------------------------------


Public Function Exec_ems_GetNextCounters( _ 
    ByVal strConnect As String, _ 
    ByVal TableName As String, _ 
    ByVal HowMany As Long, _ 
    ByVal  As Long ) As ADODB.Recordset

On Error Resume Next

Dim cnn As New ADODB.Connection
Dim com As New ADODB.Command

    cnn.Open strConnect
    Set com.ActiveConnection = cnn

    With com

        .CommandText = "ems_GetNextCounters"
        .CommandType = adCmdStoredProc

        .Parameters.Append .CreateParameter("RETURN_VALUE", adInteger, adParamReturnValue, , 0)
        .Parameters.Append .CreateParameter("@TableName", adVarChar, adParamInput, 75, TableName)
        .Parameters.Append .CreateParameter("@HowMany", adInteger, adParamInput, 8, HowMany)
        .Parameters.Append .CreateParameter("@NextCounter", adInteger, adParamOutput)

        Set Exec_ems_GetNextCounters = .Execute(lngRecordsAffected)
        strSQL7Error = Err.Description

    End With

    Set com.ActiveConnection = Nothing
    Set cnn = Nothing

End Function



See All Articles by Columnist Danny Lesandrini


Go to page: Prev  1  2  3  4  

Tools:
Add databasejournal.com to your favorites
Add databasejournal.com to your browser search box
IE 7 | Firefox 2.0 | Firefox 1.5.x
Receive news via our XML/RSS feed







Latest Forum Threads
Database Journal Home Forum
Topic By Replies Updated
set goto Error_done??? mm80x 1 November 21st, 08:54 AM
Backups goosed 14 November 21st, 08:12 AM
Where is the storage place in sybase? mathan 0 November 21st, 07:36 AM
Oracle Enterprice manager not starting databasekalyan 5 November 20th, 05:25 PM








internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers