Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pass params to stored proc in vbscript

Status
Not open for further replies.

davidste

Programmer
Mar 7, 2004
15
GB
I am trying to run the following t-sql stored proc from my VBScript page

Create Procedure getUserInfo
(
@login nvarchar(8)
)
AS
USE proj_dashboard
SELECT f_forename, f_surname, f_profile_id
FROM t_users
WHERE f_login = @login

basically I wasnt to pull in the login of the user pass it to the proc and pull out the info for that user. I use the following sql statement
strSQL = "EXECUTE getUserInfo(logon)"

where logon is a var containing the users login.

which is passed in to the following function
Private Function RecSet(byVal connstring, byVal SQL)
Const adOpenForwardOnly = 0, adOpenKeyset = 1
Const adOpenDynamic = 2, adOpenStatic = 3
Const adLockReadOnly = 1, adLockPessimistic = 2
Const adLockOptimistic = 3, adLockBatchOptimistic = 4
Const adUseServer = 2, adUseClient = 3
Dim rs, Tmp

Set rs = Server.CreateObject("ADODB.Recordset")
With rs
.CursorType = adOpenStatic
.CursorLocation = adUseServer
.LockType = adLockReadOnly
.ActiveConnection = connstring
.Source = SQL
.Open

If .BOF then
Tmp = Null
Else
Tmp = .GetRows()
End If
.Close
End With


RecSet = Tmp


Set rs = Nothing

End Function

The error I get is Incorrect syntax near 'logon'.

Thank You for any help in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top