Dear Readers
I have spent the past 3 days trying to work through the Microsoft White Paper on how to insert data into my MsAccess database and send an email confirmation to the viewer. At one stage I had the details being inserted into my database, NO EMAIL, now i have NO DATABASE ENTRY, but an EMAIL sent!!! AHHHHH
I am now receiving the following error: Microsoft JET Database Engine error '80040e14'
Syntax error (missing operator) in query expression ''00357 99944552''2rsgarry@cytanet.com.cy''House'Under 400 sqm'1 to 2 Bedrooms'1 Bathroom'No Pool'€ 150'.
/Email.asp, line 117
The coding is as follows, can someone please help me in the right direction to have this finally finished.
Regards
2rsGarry
<html>
<head>
<%
'========================================================
' When you press ENTER in a text box, a carriage return
' is created. A carriage return is represented by a
' Chr(13). Because this information will be displayed
' as HTML, replace the carriage returns with
' the <br> tag.
'========================================================
Function ParseBody(strText)
'=================================================
' This function replaces the Chr(13) with a <br>
' tag in whatever string is passed to it.
'=================================================
strText = Replace(strText, Chr(13), "<br>")
ParseBody = strText
End Function
'========================================================
' Send results to the database.
' This portion of the page sends the information
' from the form to the Northwind sample database.
'========================================================
'========================================================
' Variable declaration:
' myConnString = Connection string to database.
' myConnection = The database connection object.
' mySQL = The query string to be used.
'========================================================
Dim myConnString
Dim myConnection
Dim mySQL
'========================================================
' Set up connection string. When you created the
' database connection in FrontPage called "Sample",
' FrontPage created an Application variable in the
' Global.asa file called "Sample_ConnectionString".
'
' Use that connection string by populating the
' myConnString variable with the value contained
' in the Application variable.
'
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
' You can modify this to work with your database by
' changing "Sample_ConnectionString" to reflect your
' FrontPage database connection. For example, if you
' defined your connection in FrontPage as "Database1",
' you would change the following line to this:
' myConnString = Application("Database1_ConnectionString")
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
myConnString = Application("aapremium_ConnectionString")
'========================================================
' When you are using custom ASP to set up a connection to
' a database, you use a Connection to connect to the
' database. The following line creates that connection and
' assigns the myConnection variable to contain the
' Connection object.
'========================================================
Set myConnection = Server.CreateObject("ADODB.Connection")
'========================================================
' After the connection has been created, open it so that
' information can be written to the database. To do
' that, use the Open method and pass it the connection
' string that you defined earlier.
'========================================================
myConnection.Open myConnString
'========================================================
' This is the SQL string that queries the database.
' In this example, Request.Form("[form_field]")
' pulls information from the form and populates the SQL
' string with it.
'
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
' You can modify this SQL string to work with your own
' database by following this format. Pay special
' attention to the fact that spaces are not optional.
' -------------------------------------------------------
' mySQL= "INSERT INTO enquirydetails"
' mySQL = mySQL & "(customerIDnumber),(title),(firstname),(surname),(contactnumber),(bestcontacttime),(emailaddress),(propertylocation),(propertytype),(plotsize),(bedrooms),(bathrooms),(swimmingpool),(pricerange),(comments) "
' mySQL = mySQL & "VALUES ('cusomerIDnumber,title,firstname,surname,contactnumber,bestcontacttime,emailaddress,propertylocation,propertytype,plotsize,bedrooms,bathrooms,swimmingpool,pricerange,comments')"
' -------------------------------------------------------
' For more information about this, see the
' Customizing the Database Page section of this document..
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
mySQL = "INSERT INTO enquirydetails"
mySQL= mySQL & "([title],[firstname],[surname],[contactnumber],[bestcontacttime],[emailaddress],[propertylocation],[propertytype],[plotsize],[bedrooms],[bathrooms],[swimmingpool],[pricerange],[comments])"
mySQL= mySQL & "VALUES ('" & Request.Form("title") & "','"
mySQL= mySQL & Request.Form("firstname") & "'"
mySQL= mySQL & ",'" & Request.Form("surname") & "'"
mySQL= mySQL & ",'" & Request.Form("contactnumber") & "'"
mySQL= mySQL & Request.Form("bestcontacttime") & "'"
mySQL= mySQL & Request.Form("emailaddress") & "'"
mySQL= mySQL & Request.Form("propertylocation") & "'"
mySQL= mySQL & Request.Form("propertytype") & "'"
mySQL= mySQL & Request.Form("plotsize") & "'"
mySQL= mySQL & Request.Form("bedrooms") & "'"
mySQL= mySQL & Request.Form("bathrooms") & "'"
mySQL= mySQL & Request.Form("swimmingpool") & "'"
mySQL= mySQL & Request.Form("pricerange") & "'"
mySQL= mySQL & Request.Form("comments") & "'"
'========================================================
' Execute the connection with the SQL string.
' This runs the SQL string against the database and inputs
' the information.
'=========================================================
myConnection.Execute mySQL
'=== Close the connection.
myConnection.Close
'=== Set the connection equal to Nothing.
'=== This frees resources used by it.
Set myConnection = Nothing
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Sending email with CDO"
myMail.From="info@aa-premium.com"
myMail.To="info@aa-premium.com"
myMail.TextBody="You have a new request for further details. Please LOGIN to your back office administration area at www.aa-premium.com/admin/enquirydetails_login.asp to process."
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
'Name or IP of remote SMTP server
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") _
="mail.aa-premium.com"
'Server port
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") _
=25
myMail.Configuration.Fields.Update
myMail.Send
set myMail=nothing
%>