Problem passing the default parameters in sp 
Author Message
 Problem passing the default parameters in sp

My stored procedures don't work after I changed the driver from Native/ODBC
to OLE DB for MS SQL Server 7.0. Most of my stored procedures have default
arguments and so I don't pass all the parameters from VB to SQL server.

Ex. stored procedure defination is:
CREATE PROCEDURE my_sp



This code in VB does not work anymore and get SQL error saying parameters
are not passed:

    Dim MyDb As ADODB.Connection
    Dim StProc As ADODB.Command
    Dim params As ADODB.Parameters
    Dim lrs_recordeset As ADODB.Recordset
    Set MyDb = New Connection

    MyDb.Open "Provider=SQLOLEDB;Data Source=my_server;
database=my_database;USER ID=me;PASSWORD=***;"

    Set StProc = New Command

    With StProc
            .ActiveConnection = MyDb
            .CommandText = "my_sp"
            .CommandType = adCmdStoredProc

            Set params = StProc.Parameters

            ' Define a stored procedure parameter and append to command.

adParamInput, 25, 895)
               Set lrs_recordeset = .Execute
    End With
    Set StProc = Nothing
    MyDb.Close
    Set MyDb = Nothing


Let me know if there is an alternative.
Thanks.



Sun, 27 Mar 2005 04:08:46 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. pass parameter to SQL SP from VB and return recordset

2. Passing parameters to IF-Statement SP

3. Passing a adGuid parameters to a SP...

4. Passing a adGuid parameter to a SP...

5. Passing Parameters to IF-Statement SP

6. Don't pass a parameter to SP

7. Non-default parameter not allowed after default parameter

8. Non-default parameter not allowed after default parameter

9. Web Services parameter passing - setting default values?

10. problem passing parameters from VB5 to WORD97

11. Problems passing a fieldname as a parameter in a subroutine

12. Problem Passing parameters to select query

 

 
Powered by phpBB® Forum Software