标题:语法错误?
只看楼主
lxd0980
Rank: 7Rank: 7Rank: 7
来 自:湖南长沙
等 级:黑侠
帖 子:166
专家分:505
注 册:2011-3-27
结帖率:84.62%
已结贴  问题点数:20 回复次数:3 
语法错误?
<form action="Dell.asp" method="post">
           <div align="center">
                              <center>
                                <table border="0" width="755" cellspacing="0" cellpadding="0">
                                  <tr>
                                    <td align="center"><span class="STYLE1">SQL2000数据库删除操作系统</span>
                                  <tr>
                                    <td width="100%">
                                      <%
                                      Dim db, strConn
        strConn="provider=sqloledb.1;uid=sa;pwd=1234; initial catalog=caozuo;data source=PC-201012102302"
        Set db=Server.CreateObject("ADODB.Connection")
        db.Open strConn
                                      
                                      
                                      
                                      
                                      
                                  set rst=server.createobject("adodb.recordset")
                                  sql="select * from caozuo order by id desc"
                                  rst.open sql,strConn,3,1      
                                if Not(rst.bof and rst.eof) then'判别数据表中是否为空记录
                                        NumRecord=rst.recordcount
                                        rst.pagesize=30
                                        NumPage=rst.Pagecount
                                        if request("page")=empty then
                                        NoncePage=1
                                    else
                                    if Cint(request("page"))<1 then
                                        NoncePage=1
                                    else
                                        NoncePage=request("page")
                                    end if
                                    if Cint(Trim(request("page")))>Cint(NumPage) then NoncePage=NumPage
                                end if
                            else
                                NumRecord=0
                                NumPage=0
                                NoncePage=0
                                end if
                            %>
                                      <table border="0" width="754" bordercolorlight="#000000" cellspacing="1" cellpadding="2" bordercolordark="#FFFFFF">
                                        <tr bgcolor="#00CCCC" background="titl2.gif">
                                          <td width="102" align="center">编号</td>
                                          <td width="116" align="center">姓名</td>
                                          <td width="155" align="center">密码</td>
                                          <td width="127" align="center">电话</td>
                                          <td width="113" align="center">消息</td>
                                          <td width="110" align="center">删除</td>
                                        </tr>
                                        <%if Not(rst.bof and rst.eof) then
                                rst.move (Cint(NoncePage)-1)*30,1
                                for i=1 to rst.pagesize
                            %>
                                        <tr bgcolor="#A2DFEA">
                                          <td width="102" align="center"><%=rst("id")%></td>
                                          <td width="116" align="center"><%=rst("name")%></td>
                                          <td align="center"><%=rst("pwd")%></td>
                                          <td width="127" align="center"><%=rst("tell")%></td>
                                          <td width="113" align="center"><%=rst("message")%></td>
                                          <td width="110" align="center"><a href=Dell.asp?id=<%=rst("id")%>>删除
                                            <label>
                                            <input type="checkbox" name="checkbox" value="checkbox" />
                                            </label>
                                          </a></td>
                                        </tr>
                                        <%                 rst.movenext
                                                if rst.eof then exit for
                                                next
                            else
                                response.write "<tr><td colspan=13><marquee scrolldelay=120 behavior=alternate>没有找到任何记录!!!</marquee></td></tr>"
                            end if   
                           
                            rst.close
                            set rst=nothing
                           
                            %>
                                      </table>
                                </table>
                                
                                
                                <p>
                                  <label>
                                  <input type="submit" name="Submit" value="提交" />
                                  </label>
                                  <label>
                                  <input type="reset" name="Submit2" value="重置" />
                                  </label>
                                </p>
                              </center>
          </div>
   </form>



Dell.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
Dim db, strConn
strConn="provider=sqloledb.1;uid=sa;pwd=1234; initial catalog=caozuo;data source=PC-201012102302"
Set db=Server.CreateObject("ADODB.Connection")
db.Open strConn


dim id
id=trim(request("id"))
set rs=server.createobject("adodb.recordset")
sql="select * from caozuo where id="& id
rs.open sql,strConn,1,3    (这是第13行,问题就是出在这里.我把改成 3,4  3,3 也是这样子.)
rs.delete
rs.close
set rs=nothing
response.redirect "shuru.asp"
%>
出现以现情况:


搜索更多相关主题的帖子: 数据库 操作系统 
2011-04-25 22:31
dzt0001
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:蒙面侠
威 望:5
帖 子:1281
专家分:4998
注 册:2005-10-12
得分:10 
request("id")值为空,你表单里没有name="id"的input控件

----我怎能在别人的苦难面前转过脸去----
2011-04-26 08:57
DanYang_dan
Rank: 5Rank: 5
来 自:西安
等 级:职业侠客
帖 子:114
专家分:383
注 册:2011-4-14
得分:10 
这一行出错有可能是数据库连接出问题、或者是查询语句的问题
你按楼上的说法检查下你接收的ID的值是不是为空、、、、、

花依然很美、我们依旧幸福
                         丹扬、
2011-04-26 09:06
lxd0980
Rank: 7Rank: 7Rank: 7
来 自:湖南长沙
等 级:黑侠
帖 子:166
专家分:505
注 册:2011-3-27
得分:0 
哦,我明白了,感谢各位.
2011-04-26 20:40



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




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

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