标题:这个是ASP连接SQL的错误吗
只看楼主
yndkai
Rank: 3Rank: 3
等 级:新手上路
威 望:7
帖 子:275
专家分:0
注 册:2007-6-1
结帖率:100%
 问题点数:0 回复次数:11 
这个是ASP连接SQL的错误吗

错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]第 1 行: '=' 附近有语法错误。
/admin/tejiaedit.asp, 第 119 行


浏览器类型:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)

网页:
POST 262 ??? /admin/tejiaedit.asp

POST Data:
Page=1&citypair00=XIY&citypair01=PEK&carriertext=MU&seattext=Q&hbNotext=&faretext=1000&dlfaretext=1000&SDatetext=2006-12-22&EDatetext=2007-1-1&isGuoNei=true&isWangfan=false&explaintext=%B2%E2%CA%D4%B2 . . .

第一次用SQL 不明白这是为什么
在服务器上可以
在本地就成这样了

搜索更多相关主题的帖子: SQL ASP 
2007-07-21 12:11
SkyGull
Rank: 5Rank: 5
来 自:浙江杭州
等 级:贵宾
威 望:13
帖 子:839
专家分:324
注 册:2007-6-7
得分:0 
应该是你的代码错误,把你的代码也帖出来吧
2007-07-21 12:13
yndkai
Rank: 3Rank: 3
等 级:新手上路
威 望:7
帖 子:275
专家分:0
注 册:2007-6-1
得分:0 

但是在服务器上没问题啊
[CODE]<!--#include File="Inc/Inc_Connection.asp"-->
<!--#include File="Inc/Inc_Function.asp"-->
<%
Call chkreferrer()
Call Power("1|2",Session("flag")) '检查用户权限

Dim citypair,carrier,seat,hbNo,fare,dlfare,explain,SDate,EDate,isGuoNei,isWangfan,PiaoShu
Dim uid,Page,Temp ,Author

If uid="" And Not IsNumeric(uid) Then
Response.Write("参数错误")
Response.End()
End If

uid = Request("ID")
Page = Request("Page")
Author = Request("Who")
Temp = Split(AllSeat,"|")

If Request("Action")="Save" Then Call Update_Policy()%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>特价信息修改</title>
<link href="Style.css" rel="stylesheet" type="text/css">
<script language="javascript" src="inc/calendar.js"></script>
<script language="vbscript" type="text/vbscript">
private sub select_open1()
div1.style.left =(window.event.x - window.event.offsetX) -6
div1.style.top = (window.event.y - window.event.offsetY) +16 + document.body.scrollTop
div1.style.display=""
div2.style.display="none"
End sub
private sub select_open2()
div2.style.left =(window.event.x - window.event.offsetX) -6
div2.style.top = (window.event.y - window.event.offsetY) +16 + document.body.scrollTop
div2.style.display=""
div1.style.display="none"
End sub
sub s1()
tejia2.submit()
End sub
</script>
<script language="javascript">
function ChkModifyData()
{
if(document.form.citypair00.value=="")
{
alert('请选择出发城市!');
document.form.citypair00.focus();
return false;
}
if(document.form.citypair01.value=="")
{
alert('请选择目的城市2');
document.form.citypair01.focus();
return false;
}
if(document.form.carriertext.value=="")
{ alert('请选择航空公司!');
document.form.carriertext.focus();
return false;
}
if(document.form.seattext.value=="")
{ alert('请选择舱位!');
document.form.seattext.focus();
return false;
}
if(document.form.faretext.value=="")
{ alert('特价金额不能为空!');
document.form.faretext.focus();
return false;
}
if(document.form.dlfaretext.value=="")
{ alert('代理金额不能为空!');
document.form.dlfaretext.focus();
return false;
}
if(isNaN(document.form.faretext.value))
{ alert('特价金额不能为空,并且只能为数字!');
document.form.faretext.focus();
return false;
}
if(document.form.SDatetext.value=="")
{ alert('开始日期不能为空!');
document.form.SDatetext.focus();
return false;
}
if(document.form.EDatetext.value=="")
{ alert('结束日期不能为空!');
document.form.EDatetext.focus();
return false;
}
if(document.form.explaintext.value=="")
{ alert('签转说明不能为空!');
document.form.explaintext.focus();
return false;
}
if(document.form.seattext.value=="*" & document.form.PiaoShutext.value=="")
{
alert('舱位代码为所有舱位时,剩余票数需要填写');
document.form.PiaoShutext.focus();
return false;
}
if(document.form.seattext.value=="*" & isNaN(document.form.PiaoShutext.value))
{
alert('舱位代码为所有舱位时,票数不能为空,并且只能为数字!');
document.form.PiaoShutext.focus();
return false;
}
else
{return true;}
}
</script>
</head>

<%
Dim sql,rr
Set rr = Conn.Execute ("select Promulgator from tejia where Uid="&uid&"")
If Mid(rr("Promulgator"),1,5) <> Author Then
Response.Write("<script language=javascript>alert('对不起,您不能修改B2B的特价');history.go(-1);</script>")
Response.End()
Else
sql = "select * from tejia where uid="&uid
rec.open sql,conn,1,3
If rec.eof And rec.bof Then
Response.Write("没有记录")
Else
citypair = rec("citypair")
carrier = rec("carrier")
seat = rec("seat")
hbNo = rec("hbNo")
fare = rec("fare")
dlfare = rec("dlfare")
explain = rec("explain")
SDate = rec("SDate")
EDate = rec("EDate")
isGuoNei = rec("isGuoNei")
isWangfan = rec("isWangfan")
PiaoShu = rec("PiaoShu")
End If
rec.close
Set rec = Nothing
End If
Set rr = Nothing%>
<body>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<form name="form" method="post" action="tejiaedit.asp?Action=Save" onSubmit="return ChkModifyData()" id="tejia2">
<input type="hidden" name="Page" value="<%=Page%>" >
<tr>
<td width="100%" height="30" align="center" bgcolor="1a93d3"><font color="#FFFFFF"><b>特价信息修改</b></font></td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td width="11%" height="30" align="right" bgcolor="#FFFFFF">特价城市对:</td>
<td width="37%" bgcolor="#FFFFFF">
<% If isGuoNei = False Then %>
<input name="citypair00" type="text" id="citypair00" size="10" maxlength="3" onClick ="vbscript:select_open1()" style="width:120px;" value="<%=Left(citypair,3)%>">
<% Else %>
<select name="citypair00" id="citypair00">
<option selected value="">请选择</option>
<%Dim rs_01
Set rs_01 = Conn.Execute("select * from city where country='中国'")
Do while not rs_01.eof
Response.Write("<option value="&Replace(rs_01("threecode"),",",""))
If Ucase(rs_01("threecode")) = Ucase(Left(citypair,3)) Then Response.Write(" Selected ")
Response.Write(">" & Left(rs_01("cityname"),1) & " - " & Split(rs_01("cityname")," ")(1) & "</option>")
rs_01.movenext
loop
Set rs_01 = Nothing%></select>
<% End If %>

<% If isGuoNei = False Then %>
<input name="citypair01" type="text" id="citypair01" size="10" maxlength="3" onClick ="vbscript:select_open2()" style="width:120px;" value="<%=Right(citypair,3)%>">
<% Else %>
<select name="citypair01" id="citypair01">
<option selected value="">请选择</option>
<%Set rs_01 = Conn.Execute("select * from city where country='中国'")
Do while not rs_01.eof
Response.Write("<option value="&Replace(rs_01("threecode"),",",""))
If Ucase(rs_01("threecode")) = Ucase(Right(citypair,3)) Then Response.Write(" Selected ")
Response.Write(">" & Left(rs_01("cityname"),1) & " - " & Split(rs_01("cityname")," ")(1) & "</option>")
rs_01.movenext
loop
Set rs_01 = Nothing%></select>
<% End If %></td>
<td width="10%" align="right" bgcolor="#FFFFFF">航空公司代码:</td>
<td width="42%" bgcolor="#FFFFFF"><select name="carriertext" style="WIDTH: 120px" id="carriertext">
<option selected value="">请选择</option>
<%If IsGuoNei = true Then
Set rs_01=Conn.Execute("select * from aircocode where Iscn='是'")
Else
Set rs_01=Conn.Execute("select * from aircocode where Iscn='否'")
End If
do while not rs_01.eof
Response.Write("<option value='"&rs_01("carrier")&"'")
If rs_01("carrier") = carrier Then Response.Write(" Selected ")
Response.Write(">"&rs_01("fullname")&"</option>"&vbCrlf)
rs_01.movenext
loop
Set rs_01=Nothing %></select>请直接选择</td>
</tr>
<tr>
<td height="30" align="right" bgcolor="#FFFFFF">舱位代码:</td>
<td bgcolor="#FFFFFF"><select name="seattext" id="seattext" style="WIDTH: 120px">
<option value="*">全部</option>
<%Dim i
Temp = Split(AllSeat,"|")
for i=0 to Ubound(Temp)
Response.Write("<option value='"&Temp(i)&"'")
If Temp(i) = seat Then Response.Write(" Selected ")
Response.Write(">"&Temp(i)&"舱</option>")
next%></select>
请直接选择</td>
<td align="right" bgcolor="#FFFFFF">航班号:</td>
<td bgcolor="#FFFFFF"><input name="hbNotext" type="text" id="hbNotext" value="<%= hbNo %>" style="WIDTH: 120px">
如果是所有则不用输入,否则请真实填写</td>
</tr>
<tr>
<td height="30" align="right" bgcolor="#FFFFFF">特价金额:</td>
<td bgcolor="#FFFFFF"><input name="faretext" type="text" id="faretext" style="WIDTH: 120px" onKeyUp="this.value=this.value.replace(/\D/g,'')" value="<%= fare %>" maxlength="5" onafterpaste="this.value=this.value.replace(/\D/g,'')">
如:1000</td>
<td align="right" bgcolor="#FFFFFF">代理金额:</td>
<td bgcolor="#FFFFFF"><input name="dlfaretext" type="text" style="WIDTH: 120px" onKeyUp="this.value=this.value.replace(/\D/g,'')" value="<%= dlfare %>" maxlength="5" onafterpaste="this.value=this.value.replace(/\D/g,'')">
如:1000</td>
</tr>
<tr>
<td height="30" align="right" bgcolor="#FFFFFF">开始日期:</td>
<td bgcolor="#FFFFFF"><input name="SDatetext" type="text" id="SDatetext" onFocus="javascript:calendar(this)"; value="<%=SDate %>" style="WIDTH: 120px">
请直接选择</td>
<td align="right" bgcolor="#FFFFFF">结束日期:</td>
<td bgcolor="#FFFFFF"><input name="EDatetext" type="text" id="EDatetext" onFocus="javascript:calendar(this)"; value="<%= EDate %>" style="WIDTH: 120px">
请直接选择</td>
</tr>
<tr>
<td height="30" align="right" bgcolor="#FFFFFF">是否国内特价:</td>
<td bgcolor="#FFFFFF"><select name="isGuoNei" id="isGuoNei">
<%If isGuoNei = True Then
Response.Write("<option value=true selected='selected'>国内特价</option>")
Response.Write("<option value=false>国际特价</option>")
Else
Response.Write("<option value=true>国内特价</option>")
Response.Write("<option value=false selected=selected>国际特价</option>")
End If %></select>
请直接选择</td>
<td align="right" bgcolor="#FFFFFF">是否有往返:</td>
<td bgcolor="#FFFFFF"><select name="isWangfan" id="isWangfan">
<%If isWangfan = True Then
Response.Write("<option value=true selected='selected'>往返特价</option>")
Response.Write("<option value=false>单程特价</option>")
Else
Response.Write("<option value=true>往返特价</option>")
Response.Write("<option value=false selected=selected>单程特价</option>")
End If %></select>
请直接选择</td>
</tr>
<tr>
<td height="30" align="right" bgcolor="#FFFFFF">改签说明:</td>
<td colspan="3" bgcolor="#FFFFFF"><textarea name="explaintext" cols="60" rows="5" id="explaintext"><%=explain%></textarea>请不要输入特殊字符(如: , 。' " * ! ^ & 等)</td>
</tr>
<tr>
<td height="30" align="right" bgcolor="#FFFFFF">剩余票数:</td>
<td colspan="3" bgcolor="#FFFFFF"><input name="PiaoShutext" type="text" id="PiaoShutext" value="<%= PiaoShu %>" style="WIDTH: 120px"></td>
</tr>
<tr valign="middle">
<td height="30" align="right" bgcolor="#FFFFFF">&nbsp;</td>
<td colspan="2" align="center" bgcolor="#FFFFFF"><input name="uid" type="hidden" value="<%=uid%>">
<input type="submit" name="Submit" value="保存修改">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="button" name="Submit2" value="返 回" onClick="javascript:history.back(-1);"/></td>
<td bgcolor="#FFFFFF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
</tr>
</table>
</td>
</tr>
</form>
</table>
<div id='div1' style='Z-INDEX: 999;POSITION: absolute;display:none'>
<IFRAME frameBorder='0' id='f_main' name='f_main' src='inc/scity.asp?CITY=from' scrolling='no' style='VISIBILITY: inherit; WIDTH: 248px; HEIGHT: 103px'></IFRAME>
</div>
<div id='div2' style='Z-INDEX: 999;POSITION: absolute;display:none'>
<IFRAME frameBorder='0' id='Iframe1' name='f_main' src='inc/scity.asp?CITY=to' scrolling='no' style='VISIBILITY: inherit; WIDTH: 248px; HEIGHT: 103px'></IFRAME>
</div>
</body>
</html>
<%Sub Update_Policy()
On Error Resume Next
Dim IsError,City1,City2
carrier = Trim(Request.Form("carriertext"))
seat = Trim(Request.Form("seattext"))
hbNo = Trim(Request.Form("hbNotext"))
fare = Trim(Request.Form("faretext"))
dlfare = Trim(Request.Form("dlfaretext"))
explain = Trim(Request.Form("explaintext"))
SDate = Trim(Request.Form("SDatetext"))
EDate = Trim(Request.Form("EDatetext"))
isGuoNei = Trim(Request.Form("isGuoNei"))
isWangfan = Trim(Request.Form("isWangfan"))
PiaoShu = Trim(Request.Form("PiaoShutext"))
City1 = Left(Trim(Request.Form("citypair00")),3)
City2 = Left(Trim(Request.Form("citypair01")),3)
IsError = False
If isGuoNei="true" Then
isGuoNei = True
Else
isGuoNei = False
End If
If isWangfan="true" Then
isWangfan = True
Else
isWangfan = False
End If
If seat = "*" Then
If PiaoShu = "" Or Not IsNumeric(PiaoShu) Then
Alert "错误","舱位是*号时,票数为必须填写项","history.back(-1)"
IsError = True
End If
Else
If PiaoShu = "" Or Not IsNumeric(PiaoShu) Then
PiaoShu = 0
End If
End IF
If City1="" Or City2="" Or carrier="choose" Or fare = "" Or dlfare = "" Or explain = "" Or SDate ="" Or EDate="" Then
Alert "错误","所填写的信息不完整","history.back(-1)"
IsError = True
End If
If IsError = False Then
rec.Open "select * from tejia where uid="&Cint(Request("uid")),Conn,1,3
rec("citypair") = Ucase(City1)&Ucase(City2)
rec("carrier") = carrier
rec("seat") = seat
rec("hbNo") = hbNo
rec("fare") = fare
rec("dlfare") = dlfare
rec("explain") = LeachStr(explain)'
rec("SDate") = SDate
rec("EDate") = EDate
rec("isGuoNei") = isGuoNei
rec("isWangfan")= isWangfan
rec("PiaoShu") = PiaoShu
rec("promulgator")= "admin"
rec.Update()
rec.Close()
Set rec = Nothing
If Err Then Response.Write(err.description)

Response.Write("<script>alert('修改成功');this.location.href='tejia.asp?Page="&Page&"';</script>")
End If
End Sub%>[/CODE]


本来讨厌下雨的天空 直到听见有人说爱我
2007-07-21 12:19
yndkai
Rank: 3Rank: 3
等 级:新手上路
威 望:7
帖 子:275
专家分:0
注 册:2007-6-1
得分:0 

麻烦个位帮看看


本来讨厌下雨的天空 直到听见有人说爱我
2007-07-21 13:04
madpbpl
Rank: 4
等 级:贵宾
威 望:11
帖 子:2876
专家分:244
注 册:2007-4-5
得分:0 
能不能把你的代码出错的地方标红呀?
2007-07-21 14:52
yndkai
Rank: 3Rank: 3
等 级:新手上路
威 望:7
帖 子:275
专家分:0
注 册:2007-6-1
得分:0 

要是知道哪里错了就好了 呵呵


本来讨厌下雨的天空 直到听见有人说爱我
2007-07-21 15:28
yndkai
Rank: 3Rank: 3
等 级:新手上路
威 望:7
帖 子:275
专家分:0
注 册:2007-6-1
得分:0 

哪位帮看看


本来讨厌下雨的天空 直到听见有人说爱我
2007-07-21 18:27
yndkai
Rank: 3Rank: 3
等 级:新手上路
威 望:7
帖 子:275
专家分:0
注 册:2007-6-1
得分:0 
Set rr = Conn.Execute ("select Promulgator from tejia where Uid="&uid&"")
提示的错无是这一句的 = 号附近有错误

本来讨厌下雨的天空 直到听见有人说爱我
2007-07-21 18:29
madpbpl
Rank: 4
等 级:贵宾
威 望:11
帖 子:2876
专家分:244
注 册:2007-4-5
得分:0 
输出你的sql语句再找错误(总算找到哪出错了,加油。检查一下有没有拼写错误)

[此贴子已经被作者于2007-7-22 14:09:59编辑过]


2007-07-22 13:53
system32
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:58
帖 子:3096
专家分:0
注 册:2006-9-24
得分:0 
Set rr = Conn.Execute ("select Promulgator from tejia where Uid="&uid&"")
改成看看
Set rr = Conn.Execute ("select Promulgator from tejia where Uid='&uid&'")

[glow=200,blue,1]世界上妞是无限的,而我们的精力是有限的,用有限去搞无限,死定了。要用有限的精力去泡一个有钱妞,要发达,吃软饭![/glow]
2007-07-22 18:14



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-157034-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.078325 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved