这是.NET Petshop中用到的一个存储过程
-------------------------------------------------------------------------------
-- upAccountLogin
-------------------------------------------------------------------------------
CREATE PROCEDURE upAccountLogin
(
@username varchar(25),
@password varchar(25),
@CustomerID varchar(25) OUTPUT
)
AS SELECT @CustomerID = username
FROM signon
WHERE username = @username AND password = @Password -- if the select didn't return any rows in the result,
-- then set the customer id to an empty string to indicate a login
-- failure, otherwise the username will be returned to indicate
-- a successful login
IF @@Rowcount < 1
SELECT @CustomerID = '' GO
-------------------------------------------------------------------------------
-- upAccountLogin
-------------------------------------------------------------------------------
CREATE PROCEDURE upAccountLogin
(
@username varchar(25),
@password varchar(25),
@CustomerID varchar(25) OUTPUT
)
AS SELECT @CustomerID = username
FROM signon
WHERE username = @username AND password = @Password -- if the select didn't return any rows in the result,
-- then set the customer id to an empty string to indicate a login
-- failure, otherwise the username will be returned to indicate
-- a successful login
IF @@Rowcount < 1
SELECT @CustomerID = '' GO
谢谢楼上这位朋友!
立即结贴