Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 problem using a stored procedure

Author  Topic 

mdean9999
Starting Member

21 Posts

Posted - 2011-03-06 : 16:17:43
help! what is wrong with the following code for executing the stored procedure?
It works fine on the classic ASP website
thanks
------------------------------------------


IF not ValidateAdmin(strEmail, strPassword) THEN
........
END IF


----------------------------------------------

FUNCTION ValidateAdmin (strEmail, strPassword)

Const adCmdStoredProc = 4
Const adInteger = 3
Const adCurrency = 6
Const adParamInput = 1
Const adParamOutput = 2
Const adExecuteNoRecords = 128

DIM cnnStoredProc
DIM cmdStoredProc
DIM rstStoredProc
DIM paramID

Set cmdStoredProc = Server.CreateObject("ADODB.Command")
cmdStoredProc.ActiveConnection = conn
cmdStoredProc.CommandText = "ValidateAdmin"
cmdStoredProc.parameters(1) = strEmail
cmdStoredProc.parameters(2) = strPassword
cmdStoredProc.CommandType = adCmdStoredProc
cmdStoredProc.Execute , , adExecuteNoRecords
ValidateAdmin=cmdStoredProc.Parameters("@RetID").Value
SET cmdStoredProc=NOTHING
END FUNCTION

-----------------------------------------------------------
USE [xxxx_OurNaturalPlanet]
GO
/****** Object: StoredProcedure [xxxx_dbadmin].[ValidateAdmin] Script Date: 03/06/2011 17:27:09 ******/
SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER OFF
GO
ALTER PROCEDURE [xxxx_dbadmin].[ValidateAdmin]
(
@login varchar (99),
@pword varchar (24),
@Retid int OUTPUT
)
AS
SELECT @Retid= ID FROM admin WHERE AdminID=@login AND login=@pword
RETURN @Retid

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-03-06 : 17:07:35
Are you getting an error? If so, please post it.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -