浙江私家车107广播:asp 数据库添加问题?

来源:百度文库 编辑:中科新闻网 时间:2024/05/08 19:41:29
<!-- #include file="conn.asp" -->
'打开数据库连接并读取记录
Set objRS = server.createobject("adodb.recordset")
objrs.open "select * from 回复留言 where subject='"&subject&"' and username='"&username&"'"
新增记录
objRS.AddNew Array("username","subject","comment","Num","TTime"), _
Array(UserName, subject, comment, Num+1, TTime)
objRS.Update

'关闭数据库连接并释放对象
objRS.Close
Set objRS = Nothing

conn的代码:
<%
StrSQL="DBQ="+server.mappath("book.mdb")+";DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
conn.open StrSQL
%>
问题补充:Num为某一SUBJECT的回复留言的次数,当每次SUBJECT新增记录时,这个SUBJECT的Num都要加1,这样写可以吗?