Search code examples
vbastored-proceduressybaserecordset

Stored procedure does not return data if executed from VBA


I had stored procedure MySPOld in Sybase db. I created new sp MySP. This new sp returns data while executed from Sybase Sql Advantage. But not returning the data when called from VBA - Excel 2003 (EOF property of recordset is True). Here is my code..

Dim dbCon As ADODB.Connection
Dim rstTemp As New ADODB.Recordset
Dim query As String
query = "exec MySP '01/01/2010', '01/14/2010'"
dbCon.Open connectionString, "username" "password"
dbCon.CommandTimeout = 300
rstTemp.Open query, dbCon, adOpenForwardOnly

The code was working well with old sp. What could be the problem ? any idea ?

Thanks in Advance.


Solution

  • Am assuming it works ok from isql or sql advantage!

    Do you compare with null anywhere in the new procedure? I've found previously that statements like "if @var = null" behave differently when called from isql etc, compared with via VBA or vbScript. If you have something like this just change it to "if @var is null" and it'll work.