I want to insert data from HTML form into access DB but when I call to action this insertdata.asp
file I get errors.
<%
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"
%>
怪异的字段名称必须放在方括号中:
strSQL = "SELECT clientname, phone, email, lastservicedate, [more-info] FROM pelates;"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.