views:

290

answers:

1

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.

+3  A: 

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.

AdamH
Thank you very very very much Adam. It worked. I spent whole day to figure out the issue. And I wouln't have got solution even if I had spent more... Its very strange that the null value handling is different when SP called from VBA. Generally, when we write SP, we dont take front end Application into consideration. Anyway, Thanks once again ! ! !
Sambhaji
@Sam so why not mark @Adamh as your accepted answer?
Remou
Glad it worked for you, I never bothered trying to find out exactly why once I found the answer.Mark the answer as the answer if you're happy it is the answer - then i can get some badly needed points! :)
AdamH
Marked as Accepted. Thanks.
Sambhaji