标题:Microsoft OLE DB Provider for SQL Server (0x80040E14)第 1 行: ',' 附近 ...
只看楼主
haiwei521
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2009-11-14
结帖率:50%
已结贴  问题点数:20 回复次数:8 
Microsoft OLE DB Provider for SQL Server (0x80040E14)第 1 行: ',' 附近有语法错误
<table width="95%"  border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#D1DDF5" id="f">
    <tr>
      <td height="29" colspan="7" align="left" valign="middle" bgcolor="#E4EDF9"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td width="1336" align="center">产品管理</td>
          </tr>
      </table>        </td>
    </tr>
    <tr>
      <td width="45" height="31" align="center" valign="middle" bgcolor="#F1F3F5">ID</td>
      <td width="119" align="center" valign="middle" bgcolor="#F1F3F5">编号</td>
      <td width="189" align="center" valign="middle" bgcolor="#F1F3F5"><span class="main_topbg"><span class="hei">产品名称</span></span></td>
      <td width="97" align="center" valign="middle" bgcolor="#F1F3F5"><span class="main_topbg"><span class="hei">所属分类</span></span></td>
      <td width="274" align="center" valign="middle" bgcolor="#F1F3F5"><span class="main_topbg"><span class="hei">图片</span></span></td>
      <td width="51" align="center" valign="middle" bgcolor="#F1F3F5"><span class="main_topbg hei">排序</span></td>
      <td width="138" align="center" valign="middle" bgcolor="#F1F3F5"><span class="main_topbg">
        <input name="checkbox" type=checkbox onClick="this.value=check(this.form.selAnnounce)" value="全选">
全选
<input name="submit2" type='submit' value='删除'>
      <%

do while not rs.eof   
i=i+1

                                   id=rs("id")
                                  cpmc=rs("cpmc")
                                  cpbh=rs("cpbh")
                                  anclassid=rs("anclassid")
                                  nclassid=rs("nclassid")
                                  pic=rs("pic")                                 
                                  intro=rs("intro")   
                                  sort=rs("sort")   
                                  show=rs("show")
                                  Keywords=rs("Keywords")        

                                  set rss=server.createobject("adodb.recordset")

                                  sql="select * from yuzhiguo_anclass where anclassid="&anclassid&""
                                   
                                  rss.open sql,conn,1,1   //附近有语法错误   
                                  rss.close
%>
      </span></td>
    </tr>
    <tr>
      <td height="31" align="center" valign="middle" bgcolor="#F1F3F5"><font face="Arial"><%=rs("id")%></font></td>
      <td height="31" align="center" valign="middle" bgcolor="#F1F3F5"><span class="myweb_td"><font face="Arial"><%=cpbh%></font></span></td>
      <td align="center" valign="middle" bgcolor="#F1F3F5"><span class="a2"><%=cpmc%><br>
          <%if show=true then%>
          <font color="#0000FF">√隐身产品</font>
          <%end if%>
      </span></td>
      <td align="center" valign="middle" bgcolor="#F1F3F5"><span class="myweb_td"><%=rs("e_cpmc")%></span></td>
      <td align="center" valign="middle" bgcolor="#F1F3F5"><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="5"></td>
        </tr>
      </table>        <span class="myweb_td"><img src="<%=rs("pic")%>" width="100" height="100" border="0"></span>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="3"></td>
        </tr>
      </table></td>
      <td align="center" valign="middle" bgcolor="#F1F3F5"><span class="myweb_td"><%=sort%></span></td>
      <td align="center" valign="middle" bgcolor="#F1F3F5"><span class="myweb_td"><a href="pro_editbook.asp?id=<%=rs("id")%>" class="a2">编辑</a>
          <input type='checkbox' name='selAnnounce' value='<%=rs("id")%>'>
      </span>
        <%
    IF i>=MaxPerPage then exit do
    rs.movenext
    loop
  %></td>
    </tr>
    <tr>
      <td height="31" colspan="7" align="center" valign="middle" bgcolor="#E4EDF9">&nbsp;</td>
      </tr>
  </table>
  </center>
搜索更多相关主题的帖子: 语法 Provider OLE Microsoft SQL 
2009-11-14 19:05
haiwei521
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2009-11-14
得分:0 
大家好,我是ASP新手,现在文件运行错误,
<%
do while not rs.eof   
i=i+1

                                  id=rs("id")
                                  cpmc=rs("cpmc")
                                  cpbh=rs("cpbh")
                                  anclassid=rs("anclassid")
                                  nclassid=rs("nclassid")
                                  pic=rs("pic")                                 
                                  intro=rs("intro")   
                                  sort=rs("sort")   
                                  show=rs("show")
                                  Keywords=rs("Keywords")        

                                  set rss=server.createobject("adodb.recordset")

                                  sql="select * from yuzhiguo_anclass where anclassid="&anclassid&""
                                   
                                  rss.open sql,conn,1,1   //附近有语法错误   
                                  rss.close
%>
错误在什么地方,我用的是SQL数据库,谢谢
2009-11-14 19:06
不说也罢
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:贵宾
威 望:39
帖 子:1481
专家分:4989
注 册:2007-10-7
得分:0 
conn未定义

此asp文件中应当有类似下面这一行吧?

<!--#include file="conn.asp" -->


看看你的conn.asp文件

===================================================
讨厌C#的行尾的小尾巴;和一对大括号{ }
===================================================
2009-11-14 19:27
haiwei521
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2009-11-14
得分:0 
<%
Dim SqlDatabaseName,SqlPassword,SqlUsername,SqlLocalName,ConnStr,Conn
        SqlDatabaseName = "wygkcnsql"      'SQL数据库名
        SqlPassword = "zmkm66"              'SQL数据库用户密码
        SqlUsername = "sa"               'SQL数据库用户名     
        SqlLocalName = "127.0.0.1"    'SQL主机IP地址(本地可用“127.0.0.1”或“(local)”,非本机请用真实IP)
        ConnStr = "Provider = Sqloledb; User ID = " & SqlUsername & "; Password = " & SqlPassword & "; Initial Catalog = " & SqlDatabaseName & "; Data Source = " & SqlLocalName & ";"
        Set conn = Server.CreateObject("ADODB.Connection")
        conn.open ConnStr
 sub CloseConn()
    conn.close
    set conn=nothing
 end sub
%>
你好,我的CONN文件是这样的,什么地方有错误,您能提示我一下吗,谢谢
2009-11-14 19:47
不说也罢
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:贵宾
威 望:39
帖 子:1481
专家分:4989
注 册:2007-10-7
得分:5 
CONN文件没有错
anclassid 字段是什么类型的?
sql="select * from yuzhiguo_anclass where anclassid='"&anclassid&"'"//此句加上两个单引号试试


===================================================
讨厌C#的行尾的小尾巴;和一对大括号{ }
===================================================
2009-11-14 20:11
不说也罢
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:贵宾
威 望:39
帖 子:1481
专家分:4989
注 册:2007-10-7
得分:5 
anclassid=rs("anclassid")//检查一下这里的anclassid是不是NULL,如果是,则会出现错误
.....
sql="select * from yuzhiguo_anclass where anclassid="&anclassid&""//检查一下这里的anclassid是不是NULL,如果是,则会出现错误

===================================================
讨厌C#的行尾的小尾巴;和一对大括号{ }
===================================================
2009-11-14 20:20
haiwei521
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2009-11-14
得分:0 
上一个可以了,但是进去以后又出来问题了,Microsoft VBScript 运行时错误 (0x800A000D)类型不匹配: 'anclassid'

    <%
rs.open "select * from yuzhiguo_anclass order by anclassidorder",conn,1,1
if rs.eof and rs.bof then
response.write "请先添加分类"
response.end
else
%>
<select name="anclassid" class="wenbenkuang" size="1" id="anclassid" onChange="changelocation(document.myform.anclassid.options[document.myform.anclassid.selectedIndex].value)">
<%
do while not rs.eof
%>
<option value="<%=rs("anclassid")%>" <%if anclassid=rs("anclassid") then%>selected<%end if%>><%=trim(rs("anclass"))%></option>
<%
rs.movenext
loop
end if
rs.close
%>
</select>
<%
if nclassid="" then
%>
<select name="Nclassid">
<option value="">未选小类</option>
</select>
<%
else
set rss=server.CreateObject("adodb.recordset")
rss.open "select * from yuzhiguo_nclass where anclassid="&int(anclassid)&"",conn,1,1  错语语法
%>
<select name="Nclassid">
<option value="">未选小类</option>
<%
do while not rss.eof
nclass=rss("nclass")
%>
<option value="<%=rss("nclassid")%>" <%if int(rss("nclassid"))=int(nclassid) then response.Write("selected") %>><%=nclass%></option>
<%
rss.movenext
loop
%>
</select>
<%end if%>
又出现一个问题
2009-11-14 21:13
chenguoxing517
Rank: 7Rank: 7Rank: 7
来 自:广东广州
等 级:黑侠
威 望:1
帖 子:154
专家分:619
注 册:2009-9-28
得分:5 
看下anclassid的值是否正常?
2009-11-14 22:43
aspic
Rank: 17Rank: 17Rank: 17Rank: 17Rank: 17
等 级:贵宾
威 望:51
帖 子:2258
专家分:8050
注 册:2008-2-18
得分:5 
最近类似的问题都好几个了 其实是一样的
应该在程序的开头就获取参数进行判断 如果为空或者别的不符合条件 就进行跳转回首页或者上一个页面了 这样就不会有这样的语法错误的提示了
2009-11-15 09:11



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




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

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