I'm doing some maintenance work on a client's VB6 system. I've written a new stored proc as follows...
DECLARE @p_dt smalldatetime
DECLARE @p_AcctNo char(13)
IF EXISTS (SELECT * FROM tblHist WHERE AcctNo = @p_AcctNo And Indic = 'Y' And @p_dt BETWEEN StartDate AND EndDate)
SELECT -1
ELSE
SELECT 0
If I furnish a value for the two parameters and execute it, it always returns the correct result -- either 0 or -1.
Here is the VB6 code that calls this proc.
Public Function getValue(Acctno As String, dt As String) As Boolean
Dim rs As ADODB.Recordset
Dim ssql As String
ssql = "prc_select_value '" & Acctno & "', 2, '" & dt & "'"
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient
rs.Open ssql, MDIForm1.dcnn
getValue = rs(0).Value
rs.Close
Set = Nothing
End Function
This always receives a value of zero in rs(0) even though the sql proc returns -1 for the same input account number and date.
Any thoughts would be most welcome.
DECLARE @p_dt smalldatetime
DECLARE @p_AcctNo char(13)
IF EXISTS (SELECT * FROM tblHist WHERE AcctNo = @p_AcctNo And Indic = 'Y' And @p_dt BETWEEN StartDate AND EndDate)
SELECT -1
ELSE
SELECT 0
If I furnish a value for the two parameters and execute it, it always returns the correct result -- either 0 or -1.
Here is the VB6 code that calls this proc.
Public Function getValue(Acctno As String, dt As String) As Boolean
Dim rs As ADODB.Recordset
Dim ssql As String
ssql = "prc_select_value '" & Acctno & "', 2, '" & dt & "'"
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient
rs.Open ssql, MDIForm1.dcnn
getValue = rs(0).Value
rs.Close
Set = Nothing
End Function
This always receives a value of zero in rs(0) even though the sql proc returns -1 for the same input account number and date.
Any thoughts would be most welcome.