日期:2014-05-16 浏览次数:20626 次
<!-- #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<>"" then rs("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<>"" then rs("object_end_time")=object_end_time
rs("object_money")=object_money
rs.update
rs.close
Call