最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
asp保存数据到access数据库代码
时间:2022-06-29 14:24:35 编辑:袖梨 来源:一聚教程网
数据库连接代码
<%
dbname="chatroom.mdb"
set conn=server.createobject("adodb.connection")
connstr="dbq="+server.mappath(dbname)+";driver={microsoft access driver (*.mdb)};"
conn.open connstr
%>
html页面代码
postmsg
处理页面可保存在同一页面
<%
ac=request.querystring("act") '读取act 的值
if ac="addmsg" then 'act的值为addmsg
if request.form("hidden")<>"" then '私聊
session("chat")="" '清空session("chat")中的内容
'把要显示的私聊信息保存在application("chat")中
application("chat")=""&request.form("username")&"悄悄地对"&request.form("rname")&"说:"&request.form("msg")&""&time()&""
application("chatto")=request.form("rname") '聊天对象
application("owner")=request.form("username") '发言者
else '不是私聊
set rs=server.createobject("adodb.recordset") '创建recordset对象
sql="select * from chat" '查询数据库
rs.open sql,conn,1,3 '执行查询
rs.addnew '添加一条新记录
rs("fromname")=request.form("username") '发言者
rs("toname")=request.form("rname") '聊天对象
rs("chat")=request.form("msg") '显示的私聊信息
rs("posttime")=time() '提交时间
rs.update
rs.close
set rs=nothing
'增加一条聊天记录,将application("gchatnum")的值加1
application("gchatnum")=application("gchatnum")+1
end if
end if
%>源码下载地址
相关文章
- 不思议迷宫咒灵试炼怎么过 05-17
- 崩坏星穹铁道如狼成就怎么获取 05-17
- DNF手游安图恩困难模式怎么打 DNF手游安图恩困难模式攻略技巧 05-17
- 崩坏星穹铁道如狼成就怎么获取 崩坏星穹铁道如狼成就获取方法 05-17
- 不思议迷宫咒灵试炼怎么过 不思议迷宫咒灵试炼攻略 05-17
- 《复体重剪版》游戏攻略 简述+配置+下载 05-17