时间:2021-07-01 10:21:17 帮助过:28人阅读
=================存储过程=======================
ALTER PROCEDURE [dbo].[CreatUser]
-- Add the parameters for the stored procedure here
@Username varchar(50),
@userPassword varchar(50),
@QQID varchar(11),
@nResult int output
AS
BEGIN
declare @Qid int
set @Qid=null
select @Qid=id from [user] where qusername=@Username
if @Qid is not null
begin
set @nResult=-1
Goto theEnd
end
INSERT INTO [qqmsg].[dbo].user
select @QQID,@Username,@userPassword
set @nResult=0
theEnd:
SET NOCOUNT ON;
END
-- =============================================
-- Author: Liushuming
-- Create date: today
-- Description: for some usage
-- =============================================
ALTER PROCEDURE [dbo].[insertFriendGroup]
-- Add the parameters for the stored procedure here
@GroupName varchar(50),
@Ownerqid varchar(11),
@Groupid int output
AS
BEGIN
declare @Qid int
set @Qid=null
select @Qid=id from [user] where qid=@Ownerqid
if @Qid is null
set @Groupid=-1
else
begin
set @Qid =null
select @Qid=id from [qqmsg].[dbo].[FriendQIDFolder] where [ownerQid]=@Ownerqid and [FolderName]=@GroupName
if @Qid is null
begin
INSERT INTO [qqmsg].[dbo].FriendQIDFolder
select @Ownerqid,@GroupName
select top 1 @Groupid=id from [FriendQIDFolder] where
[ownerQid]=@Ownerqid and [FolderName]=@GroupName
end
else
set @Groupid=-2
endSET NOCOUNT ON;
END
====================asp文件==================
dim Username,userPassword,QQID
Username=request("Username"):Username=Checkstr(Username)
userPassword=request("userPassword"):userPassword=Checkstr(userPassword)
QQID=request("QQID"):QQID=Checkstr(QQID)
Username=trim(Username):userPassword=trim(userPassword):QQID=trim(QQID)
if Username="" or userPassword="" or QQID="" then
response.write "err"
else
call StoreData()
end if
call CloseConn()
sub StoreData()
on error resume next
Dim Cmd
Set cmd = Server.CreateObject("ADODB.Command")
Set cmd.ActiveConnection=conn
cmd.CommandText="[CreatUser]"
cmd.CommandType=4
cmd.Parameters.Append cmd.CreateParameter("@Username",201,1,50) cmd.Parameters.Append cmd.CreateParameter("@userPassword",201,1,50) cmd.Parameters.Append cmd.CreateParameter("@QQID",201,1,11) cmd.Parameters.Append cmd.CreateParameter("@nResult",3,2,4) cmd("@Username")=Username cmd("@userPassword")=userPassword cmd("@QQID")=QQID Cmd.Execute
if err then
response.write "err"&err.description
else
response.write Cmd("@nResult")
end if
end sub