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

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

WBOY
Release: 2016-06-02 11:32:38
Original
1117 people have browsed it

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>
Copy after login

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>
Copy after login

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

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template