日期:2014-05-17  浏览次数:20812 次

asp+access 保存数据问题
VB code

set rs=server.createobject("adodb.recordset") 
     sql="select * from t_news"
    rs.open sql,conn,3,3
    rs.addnew         '添加记录到数据表末端 
    rs("title")    =    Request("title")
  rs("content")    =    Request.Form("editor1")
  rs("logtime") = now
    rs.update         '更新数据表记录
    rs.close
    set rs=nothing



我这段代码,怎么不能保存到access中呢


------解决方案--------------------
conn打开了吗?
VBScript code

<%
set conn = CreateObject("ADODB.Connection")
conn.Open "....."
set rs = createobject("adodb.recordset") 
rs.CursorLocation = 3
sql = "select * from t_news where 1=0"
rs.open sql,conn,1,3
rs.addnew 
rs("title") = Request("title")
rs("content") = Request("editor1")
rs("logtime") = now()
rs.update
rs.close
set rs = nothing
conn.close
set conn = nothing
%>