DAO and Sybase Stored Procedures 
Author Message
 DAO and Sybase Stored Procedures

I am looking for some help:   I  am using DAO within a  VB4 app.  The
database is  Sybase System 10  with  Stored Procedures that pass in
parameters..

Some of the stored procedures use parameters, some do not.  Some Stored
Procedures return Recordsets, and some just Insert or Update rows.    I
am comfortable with calling SQL strings within the code, ie.. they are
hard coded in.  But when I call these Sybase Stored Procedures, I get
mixed results. Are there any issues involving Sybase Stored procedures
within VB code.

I initially set up the following:

Public Const SelectEmployee_MTI01 As String = "{Call
SelectEmployee_MTI01 (?)}"
Public Const UpdateEmployee_MTI35 As String = "{Call
UpdateEmployee_MTI35 (?)}"

Here is the Stored  Procedure  code from WISQL:

SelectEmployee_MTI01


as
SELECT  EMPLOYEE.AUTH_LEVEL,
          EMPLOYEE.EMPLOYEE_NAME
From  EMPLOYEE

The databases are small, so I went with DAO, for easy maintainability.
Do you think I can use DAO, and still call these stored procedures with
parameters?

Here is a sample, of what worked and what did not.  Any help would be
appreciated.

Private Sub cmdOK_Click()

    Dim Ds As Recordset
    Dim SQLx As String

    ' Check password to see if it is legit
    If txtPassWord <> Password$ Then
      MsgBox "Password entered is not correct, try again.", 0, "ID
Sign-On"
      Exit Sub
    End If

    ' Now call the Stored Procedure to retrieve the Employee row.
    ' This works
    ' SQLx = "SelectEmployee_MTI01 A999999"      ' I hard coded in my ID
for it to work to test the SP

    ' This doesn't
    ' SQLx = "SelectEmployee_MTI01" & UID$        'UID$ is my ID from
the INI file

    ' This works
    SQLx = "SELECT * FROM EMPLOYEE WHERE EMPLOYEE.AETNA_NUMBER = " +
Chr(34) + UID$ + Chr(34)    ' Hard coding in

    Set Ds = Db.OpenRecordset(SQLx, dbOpenDynaset, dbSQLPassThrough)
    If Ds.RecordCount <> 1 Then
        MsgBox "ID entered is not correct, try again.", 0, "ID Sign-On"
    Else
        MsgBox "Welcome " + Ds!EMPLOYEE_NAME + " to the Mellon Trustee
Interface System.", 0, "ID Sign-On"
        EE_Auth_Level% = Ds.Fields("AUTH_LEVEL").Value

'************************************************************************************

        '*   Set signon indicator to -1 for this
employee                                   *

'***********************************************************************************

        ' This works
        SQLx = "UPDATE EMPLOYEE SET SIGNON_IND = -1 WHERE
EMPLOYEE.AETNA_NUMBER = " + Chr(34) + UID$ + Chr(34)

        ' These do not
        ' SQLx = "UpdateEmployee_MTI35 A999999"
        ' SQLx = "UpdateEmployee_MTI35" & UID$

        Db.Execute SQLx          ' Here I only want to update

        frmLogon.Hide      ' Makes the log on screen invisible.

    End If

End Sub



Mon, 23 Oct 2000 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Sybase stored procedures through DAO

2. Retrieve parameters from stored procedure in sybase

3. Passing parameter to Sybase ASA Stored procedure via ADO

4. Sybase V11.2 and VB5 Stored Procedure

5. SQLCancel with Sybase stored procedures

6. Sybase and Stored PROCEDURES

7. Executing stored procedures on Sybase from ASP

8. Vb3.0 CR4.0 Paso de parametros a stored procedure sybase

9. Executing a stored procedure in a Sybase SQL anywhere database, VB5 Enterprise

10. Sybase Anywhere 7.0 stored procedure call fail

11. Stored Procedure / Parameter / Sybase / odbc

12. Retrive output parameters when using stored procedure in Sybase database

 

 
Powered by phpBB® Forum Software