
Accessing SQL Server Procs from VB5
Hello All,
I have a problem accessing a SQL Server Procedure from VB5
my proc is small:
create proc titlesbyauthor
as
select au_lname
from authors
I am using a rdoConnection in VB.
I have VB setup to link to the SQL Server Proc just fine
my problem is in accessing the data.. I am reading the hitchhikers
guide.
The author talks about getting an "Invalid use of NULL error" when it
is setup
like this:
Dim ucTest As New UserConnection1
Dim rs As rdoResultset
Private Sub Command1_Click()
Dim RETURN_VALUE As Integer
Dim lrc As Long
lrc= ucTest.titlesbyauthor("White") **error occurs**
End Sub
so, he talks about declaring the variable to capture the value as a
variant.
But, in this case you have to test for NULL in case the Stored Proc
doesnt
return the status value until later. So I tried this.
Dim ucTest As New UserConnection1
Dim rs As rdoResultset
Private Sub Command1_Click()
Dim RETURN_VALUE As Integer
Dim lrc As Long
Dim vRetVal As Variant
Do While vRetVal = Null
vRetVal = ucTest.titlesbyauthor("White")
Loop
datafound(0) = RETURN_VALUE
datafound(1) = vRetVal
End Sub
I can only return the RETURN_VALUE my vRetVal is coming up
empty but, I am not getting any errors
could anyone direct me the right way. Or tell me a better way to access
procedures using RDO from VB5. Thanks!!!!!!!!!!!!! Chip