首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Ajax >

大神们,这里的语句为什么在这个页面不无刷新更新?帮小弟我看看,不会又是那里数据类型不对吧?少那些字符串符号

2013-03-04 
大神们,这里的语句为什么在这个页面不无刷新更新?帮我看看,不会又是那里数据类型不对吧?少那些字符串符号?

大神们,这里的语句为什么在这个页面不无刷新更新?帮我看看,不会又是那里数据类型不对吧?少那些字符串符号?
请看这个后台文件的红色部分!问题也是从这里反应出来的,不会是其它几个后面页面有问题?
plan2.asp

<!-- #include file="include/adoconn.asp" -->

<%
'=========================================
'功能:ajax实现无刷新对数据库的操作
'有添加、删除、修改、分页
'使用的是jquery框架
'作者:wangsdong
'来源:www.aspprogram.cn
'友情下载:脚本之家(http://www.jb51.net)
'文章为作者原创,转载请注明文章出处、保留作
'者信息,谢谢支持!
'=========================================

'此为后台文件
response.addheader"content-type","text/html;charset=gb2312"
id=request("id")
set rs=server.CreateObject("adodb.recordset")
   act=request("act")   
   if act="" or act="add" then
     call add()
   elseif act="list" then
      call manage()
   elseif act="del" then
      call del()
   elseif act="modify" then
      call modify()
   ElseIf act="edit" Then
      Call edit()
   end If
sub del() '删除
   page=request("page")
   sql="delete from shuisheng where object_id="&id
   conn.execute(sql)   
   Call manage()   
end sub

Sub edit() '编辑
    sql="select object_id,ph,object_start_time,object_end_time,object_money,object_time from shuisheng where object_id="&id&""
rs.open sql,conn,1,1
If rs.eof Then
Else
    object_id = rs("object_id")
ph = rs("ph")
object_start_time = trim(rs("object_start_time"))
object_end_time = trim(rs("object_end_time"))
object_money = rs("object_money")
'order_id = rs("order_id")
response.write object_id&"|"&ph&"|"&object_start_time&"|"&object_end_time&"|"&object_money
response.end
End If
rs.close
End Sub
sub modify() '编辑保存
ph = VbsUnEscape(request("ph"))
object_start_time = request("object_start_time")
object_end_time = request("object_end_time")
object_money = request("object_money")
sql="select * from shuisheng where object_id="&request("id")
rs.open sql,conn,1,3
rs("ph")=ph
if object_start_time<>"" then rs("object_start_time")=object_start_time
if object_end_time<>"" thenrs("object_end_time")=object_end_time
rs("object_money")=object_money
rs.update
rs.close
response.write 1
end sub   
sub add() '添加
ph = VbsUnEscape(request("ph"))
object_start_time = request("object_start_time")
object_end_time = request("object_end_time")
object_money = request("object_money")
sql="select * from shuisheng where object_id=null"
rs.open sql,conn,1,3
rs.addnew
rs("ph")=ph
if object_start_time<>"" then rs("object_start_time")=object_start_time
if object_end_time<>"" thenrs("object_end_time")=object_end_time
rs("object_money")=object_money
rs.update
rs.close 
Call manage()
end sub   
sub manage()  '分页   


%>
<%
sql="select object_id,ph,object_start_time,object_end_time,object_money,object_time from shuisheng order by object_id desc"
rs.open sql,conn,1,1
If rs.eof Then
Else
    rs.pagesize=4
    page=request("page")
    If Not Isnumeric(page) or page="" Then
      page=1
    else
      page=cint(page)
    End if
    if page<1 then page=1
    if page>rs.pagecount then page=rs.pagecount
    rs.AbsolutePage = page
response.write ("<table width=""100%"" border=""1"" cellspacing=""0"" cellpadding=""0"">")
response.write "<tr><td align=""center"" height=""25"">序号</td><td align=""center"">计划名称</td><td align=""center"">开始时间</td><td align=""center"">结束时间</td><td align=""center"">所需费用</td><td  align=""center"">操作</td></tr>"
    for i=1 to rs.pagesize
    object_id = rs("object_id")
    ph = rs("ph")
    object_start_time = trim(rs("object_start_time"))
if isnull(object_start_time) then object_start_time="&nbsp;"
    object_end_time = trim(rs("object_end_time"))
if isnull(object_end_time) then object_end_time="&nbsp;"
    object_money = rs("object_money")
    'order_id = rs("order_id")
    object_time = rs("object_time")
    '******************下面是你要显示的******************'
if i mod 2= 0 then
  bgcolor="#eeeeee"
else
  bgcolor="#ffffff"
end if
response.write ("<tr id=""fff"&object_id&""" bgcolor="&bgcolor&">")
response.write ("<td height=""22"" align=""center"">"&object_id&"</td>")
response.write ("<td align=""center""><span id=""gname1"&object_id&""" name=""gname1"&object_id&"""><input type=""text""  size=""5"" value="&ph&" maxlength=""20""  style=""border:1px solid #FFFFFF; ime-mode:Disabled; color:#800000; font-weight:bold; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px; background-color:#FFFFFF; cursor:hand;"" onClick=""forder('&object_id&','&ph&','shuisheng','ph','object_id','gname1');""></span>")    '******************上面这里换成这样就不能修改,但是这一段代码配合modify_ajax.js、modify_ajax.asp和jquery.js独立放在其它的地方可以运行呀。为什么在这里就出现了问题,不能无刷新修改******************'

response.write ("</td>")
response.write ("<td align=""center"">"&object_start_time&"")
response.write ("</td>")
response.write ("<td align=""center"">"&object_end_time&"")
response.write ("</td>")
response.write ("<td align=""center"">"&object_money&"")
response.write ("</td>")
response.write ("<td align=""center""><a href=""javascript:;"" onclick=""javascript:edit1("&object_id&"")
response.write (");"">修改</a> <a href=""javascript:;"" onclick=""javascript:del1("&object_id&","&page&")"">删除</a></td>")


response.write ("</tr>")
    '******************上面是你要显示的******************'
    rs.movenext
    if rs.eof then
      Exit For
    End if
    next
response.write "<tr><td height=""22"" colspan=6>"
call fpage("act",page)
response.write "</td></tr>"
response.write "</table>"
end if
'call fpage("id")
rs.close
set rs=nothing
end sub
set conn=nothing

Function fpage(str,page) '分布函数
s=Split(str,"|")
s2=""
For i=0 To UBound(s)
  s2=s2&"&"&s(i)&"="&request(s(i))
next
response.write "<table width=""100%"" cellpadding=0 cellspacing=0 border=0>"
response.write " <tr>"
response.write " <td align=""center"" width=""95%"">&nbsp;&nbsp;信息总数:"&rs.recordcount&"个 页次:"&page&"/"&rs.pagecount&"页"
If page<=1 Then
  response.write " 首&nbsp;页 上一页 "
Else
  response.write " <a href=""javascript:;"" onclick=""javascript:fpage('?page=1"&s2&"')""><font color='#ff0000'>首&nbsp;页</font></a> <a href=""javascript:;"" onclick=""javascript:fpage('?page="&(page-1)&s2&"')""><font color='#ff0000'>上一页</font></a> "
End If
If page>=rs.pagecount Then
  response.write "下一页 尾&nbsp;页 "
Else
  response.write "<a href=""javascript:;"" onclick=""javascript:fpage('?page="&(page+1)&s2&"')""><font color='#ff0000'>下一页</font></a> <a href=""javascript:;"" onclick=""javascript:fpage('?page="&rs.pagecount&s2&"')""><font color='#ff0000'>尾&nbsp;页</font></a>"
End If
response.write "</td> "
response.write " <td width=""5%""></td>"
response.write " </tr>"
response.write "</table>"
End function

'与javascript中的escape()等效
    Function VbsEscape(str)
        dim i,s,c,a 
        s="" 
        For i=1 to Len(str) 
            c=Mid(str,i,1)
            a=ASCW(c)
            If (a>=48 and a<=57) or (a>=65 and a<=90) or (a>=97 and a<=122) Then
                s = s & c
            ElseIf InStr("@*_+-./",c)>0 Then
                s = s & c
            ElseIf a>0 and a<16 Then
                s = s & "%0" & Hex(a)
            ElseIf a>=16 and a<256 Then


                s = s & "%" & Hex(a)
            Else
                s = s & "%u" & Hex(a)
            End If
        Next
        VbsEscape=s
    End Function
    '与javascript中的unescape()等效
    Function VbsUnEscape(str)
                    Dim x
        x=InStr(str,"%") 
        Do While x>0
            VbsUnEscape=VbsUnEscape&Mid(str,1,x-1)
            If LCase(Mid(str,x+1,1))="u" Then
                VbsUnEscape=VbsUnEscape&ChrW(CLng("&H"&Mid(str,x+2,4)))
                str=Mid(str,x+6)
            Else
                VbsUnEscape=VbsUnEscape&Chr(CLng("&H"&Mid(str,x+1,2)))
                str=Mid(str,x+3)
            End If
            x=InStr(str,"%")
        Loop
        VbsUnEscape=VbsUnEscape&str
    End Function
%>
<script language="javascript" src="js/jquery.js"></script>




asp 表格无刷新提交 数据类型错误
[解决办法]
链接字符串有问题

response.write ("<td align=""center""><span id=""gname1"&object_id&""" name=""gname1"&object_id&"""><input type=""text""  size=""5"" value="&ph&" maxlength=""20""  style=""border:1px solid #FFFFFF; ime-mode:Disabled; color:#800000; font-weight:bold; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px; background-color:#FFFFFF; cursor:hand;"" onClick=""forder('"&object_id&"','"&ph&"','shuisheng','ph','object_id','gname1');""></span>")

热点排行