Hi guys, I've got a relatively simple question here to do with SQL and ASP, hope you can help.
Here's my sp...
CREATE PROCEDURE [sp_insert_siteListings]
(@siteUsername [varchar](50),
@sitePassword [varchar](50))
AS
BEGIN
DECLARE @UserVal [int]
EXEC sp_validate_Username @siteUsername, @UserVal OUTPUT
IF @UserVal = 0
INSERT INTO [siteListings]
([siteUsername],
[sitePassword])
VALUES
(@siteUsername,
@sitePassword)
END
RETURN @UserVal
GO
CREATE PROCEDURE [sp_Validate_Username]
@UserName [varchar](50),
@UserExists [int] OUTPUT
AS
BEGIN
DECLARE @UserVar [varchar](50)
SELECT @UserVar = siteUsername
FROM siteListings
WHERE siteUsername = @UserName
IF @UserVar <> NULL
SET @UserExists = 1
ELSE
SET @UserExists = 0
END
GO
These I'm happy with.
My ASP code is like so... (modified)
strSQLS = "EXEC sp_insert_SiteListings '" & fUserName & "', '" & fPassword & "'"
Set objRSS = Server.CreateObject("ADODB.Recordset"
objRSS.Open strSQLS, objConn
I've obviously declared all variables and included a connection object too. What I want to know is what to write to display and use the @UserVal OUTPUT variable from my SQL. I've tried objRSS.Parameters("@UserVal".Value but I get an error saying that object doesn't support the Parameters method, do I HAVE to use a Command object to do this? If so , how do I go about it?
any help would be appreciated.
TIA
Al.
Here's my sp...
CREATE PROCEDURE [sp_insert_siteListings]
(@siteUsername [varchar](50),
@sitePassword [varchar](50))
AS
BEGIN
DECLARE @UserVal [int]
EXEC sp_validate_Username @siteUsername, @UserVal OUTPUT
IF @UserVal = 0
INSERT INTO [siteListings]
([siteUsername],
[sitePassword])
VALUES
(@siteUsername,
@sitePassword)
END
RETURN @UserVal
GO
CREATE PROCEDURE [sp_Validate_Username]
@UserName [varchar](50),
@UserExists [int] OUTPUT
AS
BEGIN
DECLARE @UserVar [varchar](50)
SELECT @UserVar = siteUsername
FROM siteListings
WHERE siteUsername = @UserName
IF @UserVar <> NULL
SET @UserExists = 1
ELSE
SET @UserExists = 0
END
GO
These I'm happy with.
My ASP code is like so... (modified)
strSQLS = "EXEC sp_insert_SiteListings '" & fUserName & "', '" & fPassword & "'"
Set objRSS = Server.CreateObject("ADODB.Recordset"
objRSS.Open strSQLS, objConn
I've obviously declared all variables and included a connection object too. What I want to know is what to write to display and use the @UserVal OUTPUT variable from my SQL. I've tried objRSS.Parameters("@UserVal".Value but I get an error saying that object doesn't support the Parameters method, do I HAVE to use a Command object to do this? If so , how do I go about it?
any help would be appreciated.
TIA
Al.