OK, I'm using RDO but I'm not using a UserConnection.
I started off using UserConnections because I thought they would be faster
and allow more flexibility, but they turned out to be a major pain in the
butt. Dropping and recreating stored procedures forced me to rebuild the
name even though it didn't show up in the query designer. Since I couldn't
predict when this would happen and the code for trapping it was more complex
than I wanted to maintain, I stopped using them.
Here's the VB code I'm using...
*****
Public Function IsToolIDAvailable(conn As rdoConnection, _
ByVal TestPrefix As String, _
ByVal TestNumber As Long) _
As Boolean
'**
'
' purpose:
'
' comments:
'
' history:
'
'**
Dim oQry As New rdoQuery
Dim prmAvail As rdoParameter
Dim prmErrNum As rdoParameter
Dim prmErrMessage As rdoParameter
Set oQry.ActiveConnection = conn
oQry.SQL = "{ ? = call IsToolIDAvailable (?,?,?,?,?,?)}"
prmAvail.Direction = rdParamOutput
prmErrNum.Direction = rdParamOutput
prmErrMessage.Direction = rdParamOutput
oQry.Execute
If 0 & prmErrNum.Value = 0 Then
'success
IsToolIDAvailable = IIf(0 & prmAvail.Value = 1, True, False)
Else
'error
Err.Raise prmErrNum.Value, "Tool.IsToolAvailable",
prmErrMessage.Value
End If
End Function
*****
and here's the SQL Server stored procedure it's calling...
/****** Object: Stored Procedure dbo.IsToolIDAvailable Script Date:
4/13/98 4:15:53 PM ******/
/*
returns yes(1) or no(0)(default) through bIsAvailable if the combination
of sPrefix and iNumber is acceptable.
raises errors and reutrns no(0) through bIsAvailable if prefix is bad
of number is out of range
*/
As
*/
--Build tool ID
begin
goto Done
end
--Check if ToolID is used.
Begin
goto Done
end
Done:
*****
All the values go in correctly, but on some machines (always Windows 95
machines), you get the error I mentioned.
Everything looks fine to me when I run it, but sometimes it just doesn't
work.
Tom