问题描述
- asp 文件转换php实现,主要是SQLSERVER里的存储过程转换成mysql语句写不出来!
-
=================存储过程=======================
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=0theEnd:
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=-2end SET 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=4cmd.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
解决方案
..................
解决方案二:
<?php
//强制浏览器重新访问服务器下载页面,而不是从缓存读取页面
header("Cache-Control: no-cache, must-revalidate");
//接收数据
$GroupName=$_POST['GroupName'];
$Ownerqid=$_POST['Ownerqid '];
if(empty($GroupName)||empty($Ownerqid))
{
exit('err');
}else{
StoreData();
}
function StoreData()
{
$sql="select id from FriendQIDFolder where ownerQid=".$Ownerqid." and FolderName=".$GroupName;
$conn=connect();
$myquery=$conn->query($sql);
$row= mysqli_fetch_array($myquery);
if($row){
echo -2;
return;
}else{
$sql="insert into FriendQIDFolder(ownerQid,FolderName)values()";
}
closeconn();
}
这样的写法可以么 ?大家帮下忙
解决方案三:
<?php
//强制浏览器重新访问服务器下载页面,而不是从缓存读取页面
header("Cache-Control: no-cache, must-revalidate");
//接收数据
$GroupName=$_POST['GroupName'];
$Ownerqid=$_POST['Ownerqid '];
if(empty($GroupName)||empty($Ownerqid))
{
exit('err');
}else{
StoreData();
}
function StoreData()
{
$sql="select id from FriendQIDFolder where ownerQid=".$Ownerqid." and FolderName=".$GroupName;
$conn=connect();
$myquery=$conn->query($sql);
$row= mysqli_fetch_array($myquery);
if($row){
echo -2;
return;
}else{
$sql="insert into FriendQIDFolder(ownerQid,FolderName)values()";
}
closeconn();
}
这样的写法可以么 ?大家帮下忙
解决方案四:
<?php
//强制浏览器重新访问服务器下载页面,而不是从缓存读取页面
header("Cache-Control: no-cache, must-revalidate");
//接收数据
$GroupName=$_POST['GroupName'];
$Ownerqid=$_POST['Ownerqid '];
if(empty($GroupName)||empty($Ownerqid))
{
exit('err');
}else{
StoreData();
}
function StoreData()
{
$sql="select id from FriendQIDFolder where ownerQid=".$Ownerqid." and FolderName=".$GroupName;
$conn=connect();
$myquery=$conn->query($sql);
$row= mysqli_fetch_array($myquery);
if($row){
echo -2;
return;
}else{
$sql="insert into FriendQIDFolder(ownerQid,FolderName)values()";
}
closeconn();
}
这样的写法可以么 ?大家帮下忙
解决方案五:
<?php
//强制浏览器重新访问服务器下载页面,而不是从缓存读取页面
header("Cache-Control: no-cache, must-revalidate");
//接收数据
$GroupName=$_POST['GroupName'];
$Ownerqid=$_POST['Ownerqid '];
if(empty($GroupName)||empty($Ownerqid))
{
exit('err');
}else{
StoreData();
}
function StoreData()
{
$sql="select id from FriendQIDFolder where ownerQid=".$Ownerqid." and FolderName=".$GroupName;
$conn=connect();
$myquery=$conn->query($sql);
$row= mysqli_fetch_array($myquery);
if($row){
echo -2;
return;
}else{
$sql="insert into FriendQIDFolder(ownerQid,FolderName)values()";
}
closeconn();
}
这样的写法可以么 ?大家帮下忙
解决方案六:
<?php
//强制浏览器重新访问服务器下载页面,而不是从缓存读取页面
header("Cache-Control: no-cache, must-revalidate");
//接收数据
$GroupName=$_POST['GroupName'];
$Ownerqid=$_POST['Ownerqid '];
if(empty($GroupName)||empty($Ownerqid))
{
exit('err');
}else{
StoreData();
}
function StoreData()
{
$sql="select id from FriendQIDFolder where ownerQid=".$Ownerqid." and FolderName=".$GroupName;
$conn=connect();
$myquery=$conn->query($sql);
$row= mysqli_fetch_array($myquery);
if($row){
echo -2;
return;
}else{
$sql="insert into FriendQIDFolder(ownerQid,FolderName)values()";
}
closeconn();
}
这样的写法可以么 ?大家帮下忙
解决方案七:
<?php
//强制浏览器重新访问服务器下载页面,而不是从缓存读取页面
header("Cache-Control: no-cache, must-revalidate");
//接收数据
$GroupName=$_POST['GroupName'];
$Ownerqid=$_POST['Ownerqid '];
if(empty($GroupName)||empty($Ownerqid))
{
exit('err');
}else{
StoreData();
}
function StoreData()
{
$sql="select id from FriendQIDFolder where ownerQid=".$Ownerqid." and FolderName=".$GroupName;
$conn=connect();
$myquery=$conn->query($sql);
$row= mysqli_fetch_array($myquery);
if($row){
echo -2;
return;
}else{
$sql="insert into FriendQIDFolder(ownerQid,FolderName)values()";
}
closeconn();
}
这样的写法可以么 ?大家帮下忙
解决方案八:
<?php
//强制浏览器重新访问服务器下载页面,而不是从缓存读取页面
header("Cache-Control: no-cache, must-revalidate");
//接收数据
$GroupName=$_POST['GroupName'];
$Ownerqid=$_POST['Ownerqid '];
if(empty($GroupName)||empty($Ownerqid))
{
exit('err');
}else{
StoreData();
}
function StoreData()
{
$sql="select id from FriendQIDFolder where ownerQid=".$Ownerqid." and FolderName=".$GroupName;
$conn=connect();
$myquery=$conn->query($sql);
$row= mysqli_fetch_array($myquery);
if($row){
echo -2;
return;
}else{
$sql="insert into FriendQIDFolder(ownerQid,FolderName)values()";
}
closeconn();
}
这样的写法可以么 ?大家帮下忙
解决方案九:
<?php
//强制浏览器重新访问服务器下载页面,而不是从缓存读取页面
header("Cache-Control: no-cache, must-revalidate");
//接收数据
$GroupName=$_POST['GroupName'];
$Ownerqid=$_POST['Ownerqid '];
if(empty($GroupName)||empty($Ownerqid))
{
exit('err');
}else{
StoreData();
}
function StoreData()
{
$sql="select id from FriendQIDFolder where ownerQid=".$Ownerqid." and FolderName=".$GroupName;
$conn=connect();
$myquery=$conn->query($sql);
$row= mysqli_fetch_array($myquery);
if($row){
echo -2;
return;
}else{
$sql="insert into FriendQIDFolder(ownerQid,FolderName)values()";
}
closeconn();
}
这样的写法可以么 ?大家帮下忙
解决方案十:
<?php
//强制浏览器重新访问服务器下载页面,而不是从缓存读取页面
header("Cache-Control: no-cache, must-revalidate");
//接收数据
$GroupName=$_POST['GroupName'];
$Ownerqid=$_POST['Ownerqid '];
if(empty($GroupName)||empty($Ownerqid))
{
exit('err');
}else{
StoreData();
}
function StoreData()
{
$sql="select id from FriendQIDFolder where ownerQid=".$Ownerqid." and FolderName=".$GroupName;
$conn=connect();
$myquery=$conn->query($sql);
$row= mysqli_fetch_array($myquery);
if($row){
echo -2;
return;
}else{
$sql="insert into FriendQIDFolder(ownerQid,FolderName)values()";
}
closeconn();
}
这样的写法可以么 ?大家帮下忙