Why isn't this working?? 
Author Message
 Why isn't this working??

I'm trying to call a SQL Server 7 stored procedure that has a return
and an output parameter.  I'm following an example that I was able to
find, but I'm getting an error.  See *** in the following code.

I can't see what is wrong.  Help!



Private Sub MDIForm_Load()

Dim session_userid As String
Dim param1 As adodb.Parameter
Dim param2 As adodb.Parameter

Set cnSEI = New adodb.Connection
Set objCMD = New adodb.Command
Set adoRS = New adodb.Recordset

cnSEI.Open conDBConn
Set objCMD.ActiveConnection = cnSEI
objCMD.CommandText = "spGetUserInfo"
objCMD.CommandType = adCmdStoredProc

'set up a return parameter
Set param1 = objCMD.CreateParameter("Return", adInteger, adParamReturnValue)
objCMD.Parameters.Append param1

'set up an output parameter
Set param2 = objCMD.CreateParameter("Output", adChar, adParamOutput)
objCMD.Parameters.Append param2
***The above line produces the error
***Run-time error '3708'.
***The application has improperly defined a Parameter object.

'execute the command
Set adoRS = objCMD.Execute

'need to close the recordset before geting return and ouput parameters
Debug.Print "Program ended with return code " & CStr(objCMD(0))
Debug.Print "This is session_userid " & objCMD(1)
UserInfo.session_userid = objCMD(1)


'update UserInfo
UserInfo.app_name = "PTO"

'set the constant that the holidays in the year is false
IsAddHolidaysModeYearInReview = False

sbrStatusBar.Panels(1) = "Employees: " & CStr(adoEmployees.Recordset.RecordCount)

End Sub

Fri, 09 Aug 2002 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Why isn't this working?

2. why isn't this working?

3. Why isn't this working

4. Why isn't this working?

5. Why isn't this working?

6. why isn't this working

7. Why isn't his working correctly...?

8. Why isn't this working!! Help!!!

9. Why isn't this working? - mailing with outlook

10. SHELL command within VB5. WHY ISN'T IT WORKING

11. Why isn't my code working?

12. Why isn't my filter working in the Common Dialog ShowOpen Function


Powered by phpBB® Forum Software