我想将HTML表单中的数据插入到访问数据库中,但是当我将此insertdata.asp
文件调用时,我会收到错误。
<%
Dim adoCon
Dim rsAddComments
Dim strSQL
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "Provider=Microsoft.ACE.OLEDB.12.0;DataSource=J:\John\__Ecommerce_____\ASP\DB_Form\app_data\clients.accdb"
Set rsAddComments = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT clientname, phone, email, lastservicedate, more-info FROM pelates;"
rsAddComments.CursorType = 2
rsAddComments.LockType = 3
rsAddComments.Open strSQL, adoCon
rsAddComments.AddNew
rsAddComments.Fields("clientname") = Request.Form("clientname")
rsAddComments.Fields("phone") = Request.Form("phone")
rsAddComments.Fields("email") = Request.Form("email")
rsAddComments.Fields("lastservicedate") = Request.Form("lastservicedate")
rsAddComments.Fields("more-info") = Request.Form("more-info")
rsAddComments.Update
rsAddComments.Close
Set rsAddComments = Nothing
Set adoCon = Nothing
Response.Redirect "index.asp"
%>
答案 0 :(得分:0)
必须将奇怪的字段名括起来:
strSQL = "SELECT clientname, phone, email, lastservicedate, [more-info] FROM pelates;"