连接数据库的问题!!!!!!
YHeng 2003-01-21 10:01:30 为什么以下代码总是出错!!!!!!
strcnn = "DBQ=" + server.mappath( "visitorinfo.mdb" ) + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};Pwd=911;"
set adocnn = server.CreateObject ( "ADODB.CONNECTION" )
set adorst = server.CreateObject( "Adodb.recordset" )
adocnn.Open strcnn
with adorst
set .ActiveConnection=adocnn
.CursorLocation = aduserclient
.CursorType = adopenkeyset
.LockType = adlockoptimistic
.Open "Select * From 访客信息表"
.AddNew
.Fields("姓名").Value = request.Form("txtname")
.Fields("来自").Value = request.Form("cmbfrom")
.Fields("年龄").Value = request.Form("cmbage")
.Fields("性别").Value = request.Form("cmbsex")
.Fields("职业").Value = request.Form("cmbwork")
.Fields("电邮地址").Value = request.Form("txtemail")
.Fields("留言主题").Value = request.Form("txtsubject")
.Fields("留言内容").Value = request.Form("txtcontent")
.Fields("留言日期").Value=dayvalue(now)
.Fields("留言时间").Value=timevalue(now)
.Update
.Close
end with
adocnn.Close
set adocnn = nothing
set adorst = nothing