select-asp File conversion PHP implementation, mainly SQL Server stored procedures converted to MySQL statement cannot be written out!

Source: Internet
Author: User
Keywords Select PHP
selectphp

================= Stored Procedure =======================
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,
@Ownerqid Varc Har (one),
@Groupid int output
as
BEGIN
declare @Qid int
Set @Qid =null
Select @Qid =id from [user] whe Re qid= @Ownerqid
If @Qid is null
set @Groupid =-1
Else
begin
Set @Qid =null
Select @Qid =id from [QQ MSG]. [dbo]. [Friendqidfolder] WHERE [ownerqid]= @Ownerqid and [foldername]= @GroupName
If @Qid is null
begin
INSERT into [QQ MSG]. [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 file ==================
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

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.