>  기사  >  백엔드 개발  >  select-asp 文件转换php实现,主要是SQLSERVER里的存储过程转换成mysql语句写不出来!

select-asp 文件转换php实现,主要是SQLSERVER里的存储过程转换成mysql语句写不出来!

WBOY
WBOY원래의
2016-06-02 11:32:381079검색

selectphp

=================存储过程=======================
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

<code>endSET NOCOUNT ON;</code>

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

<code>    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</code>

if err then
response.write "err"&err.description
else
response.write Cmd("@nResult")
end if
end sub

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.