PDA

Click to See Complete Forum and Search --> : Stored Procedures


Ianf
Jan 2nd, 2001, 10:40 AM
Hi

Does anyone know how to execute a stored preocedure using VBScript in ASP. The Stored Procedure returns two values indicating whether the insert has been successfull or not. I am currently up to the following and I am now officially stuck.


Dim cnSQL
Dim ResultInt
Dim Resulttxt

'All the usual database connection stuff here

'Call the stored procedure

cnSQL = "EXEC CPSDetailsAdd_Up '12345','Hello','G Day '," _
& ResultInt & "OUTPUT," & Resulttxt & "OUTPUT"

Conn.Execute(cnSQL)


Any help would be appreciated

itay222
Jan 2nd, 2001, 10:49 AM
i don't know if you can get a return value from a SP
this way,
but maybe to your case,
you can inspect the value in RecordsAffected to
see whether it succeeded or not.

hope it helps,
itay.

Ianf
Jan 3rd, 2001, 07:07 AM
How do I inspect RecordsAffected

itay222
Jan 3rd, 2001, 07:20 AM
syntax:
connection.Execute CommandText, RecordsAffected, Options

RecordsAffected
Optional. A Long variable to which the provider returns the number of records that the operation affected.


exmaple:
dim myvar as long
myconn.execute "SPNAME", myvar
msgbox myvar

didn't test it though,
goodluck.
itay.

Ianf
Jan 3rd, 2001, 08:02 AM
Hi

I now have my stored procedure working without handelling returned values. I have already tried what you suggested and couldn't get it to work.

Thanks for the help anyway. I will look into it further when I have more time stress levels are at an all time peak now.