Confused with reading Microsoft White Papers and Instructions

Please support our ASP advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
Reply

Join Date: Mar 2008
Posts: 1
Reputation: 2rsgarry is an unknown quantity at this point 
Solved Threads: 0
2rsgarry 2rsgarry is offline Offline
Newbie Poster

Confused with reading Microsoft White Papers and Instructions

 
0
  #1
Mar 22nd, 2008
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

  1. <html>
  2.  
  3. <head>
  4.  
  5. <%
  6.  
  7. '========================================================
  8. ' When you press ENTER in a text box, a carriage return
  9. ' is created. A carriage return is represented by a
  10. ' Chr(13). Because this information will be displayed
  11. ' as HTML, replace the carriage returns with
  12. ' the <br> tag.
  13. '========================================================
  14. Function ParseBody(strText)
  15. '=================================================
  16. ' This function replaces the Chr(13) with a <br>
  17. ' tag in whatever string is passed to it.
  18. '=================================================
  19. strText = Replace(strText, Chr(13), "<br>")
  20. ParseBody = strText
  21. End Function
  22.  
  23.  
  24. '========================================================
  25. ' Send results to the database.
  26. ' This portion of the page sends the information
  27. ' from the form to the Northwind sample database.
  28. '========================================================
  29.  
  30. '========================================================
  31. ' Variable declaration:
  32. ' myConnString = Connection string to database.
  33. ' myConnection = The database connection object.
  34. ' mySQL = The query string to be used.
  35. '========================================================
  36. Dim myConnString
  37. Dim myConnection
  38. Dim mySQL
  39.  
  40. '========================================================
  41. ' Set up connection string. When you created the
  42. ' database connection in FrontPage called "Sample",
  43. ' FrontPage created an Application variable in the
  44. ' Global.asa file called "Sample_ConnectionString".
  45. '
  46. ' Use that connection string by populating the
  47. ' myConnString variable with the value contained
  48. ' in the Application variable.
  49. '
  50. '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  51. ' You can modify this to work with your database by
  52. ' changing "Sample_ConnectionString" to reflect your
  53. ' FrontPage database connection. For example, if you
  54. ' defined your connection in FrontPage as "Database1",
  55. ' you would change the following line to this:
  56. ' myConnString = Application("Database1_ConnectionString")
  57. '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  58. myConnString = Application("aapremium_ConnectionString")
  59.  
  60.  
  61. '========================================================
  62. ' When you are using custom ASP to set up a connection to
  63. ' a database, you use a Connection to connect to the
  64. ' database. The following line creates that connection and
  65. ' assigns the myConnection variable to contain the
  66. ' Connection object.
  67. '========================================================
  68. Set myConnection = Server.CreateObject("ADODB.Connection")
  69.  
  70. '========================================================
  71. ' After the connection has been created, open it so that
  72. ' information can be written to the database. To do
  73. ' that, use the Open method and pass it the connection
  74. ' string that you defined earlier.
  75. '========================================================
  76. myConnection.Open myConnString
  77.  
  78. '========================================================
  79. ' This is the SQL string that queries the database.
  80. ' In this example, Request.Form("[form_field]")
  81. ' pulls information from the form and populates the SQL
  82. ' string with it.
  83. '
  84. '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  85. ' You can modify this SQL string to work with your own
  86. ' database by following this format. Pay special
  87. ' attention to the fact that spaces are not optional.
  88. ' -------------------------------------------------------
  89. ' mySQL= "INSERT INTO enquirydetails"
  90. ' mySQL = mySQL & "(customerIDnumber),(title),(firstname),(surname),(contactnumber),(bestcontacttime),(emailaddress),(propertylocation),(propertytype),(plotsize),(bedrooms),(bathrooms),(swimmingpool),(pricerange),(comments) "
  91. ' mySQL = mySQL & "VALUES ('cusomerIDnumber,title,firstname,surname,contactnumber,bestcontacttime,emailaddress,propertylocation,propertytype,plotsize,bedrooms,bathrooms,swimmingpool,pricerange,comments')"
  92. ' -------------------------------------------------------
  93. ' For more information about this, see the
  94. ' Customizing the Database Page section of this document..
  95. '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  96. mySQL = "INSERT INTO enquirydetails"
  97. mySQL= mySQL & "([title],[firstname],[surname],[contactnumber],[bestcontacttime],[emailaddress],[propertylocation],[propertytype],[plotsize],[bedrooms],[bathrooms],[swimmingpool],[pricerange],[comments])"
  98. mySQL= mySQL & "VALUES ('" & Request.Form("title") & "','"
  99. mySQL= mySQL & Request.Form("firstname") & "'"
  100. mySQL= mySQL & ",'" & Request.Form("surname") & "'"
  101. mySQL= mySQL & ",'" & Request.Form("contactnumber") & "'"
  102. mySQL= mySQL & Request.Form("bestcontacttime") & "'"
  103. mySQL= mySQL & Request.Form("emailaddress") & "'"
  104. mySQL= mySQL & Request.Form("propertylocation") & "'"
  105. mySQL= mySQL & Request.Form("propertytype") & "'"
  106. mySQL= mySQL & Request.Form("plotsize") & "'"
  107. mySQL= mySQL & Request.Form("bedrooms") & "'"
  108. mySQL= mySQL & Request.Form("bathrooms") & "'"
  109. mySQL= mySQL & Request.Form("swimmingpool") & "'"
  110. mySQL= mySQL & Request.Form("pricerange") & "'"
  111. mySQL= mySQL & Request.Form("comments") & "'"
  112. '========================================================
  113. ' Execute the connection with the SQL string.
  114. ' This runs the SQL string against the database and inputs
  115. ' the information.
  116. '=========================================================
  117. myConnection.Execute mySQL
  118.  
  119. '=== Close the connection.
  120. myConnection.Close
  121.  
  122. '=== Set the connection equal to Nothing.
  123. '=== This frees resources used by it.
  124. Set myConnection = Nothing
  125.  
  126.  
  127.  
  128. Set myMail=CreateObject("CDO.Message")
  129. myMail.Subject="Sending email with CDO"
  130. myMail.From="info@aa-premium.com"
  131. myMail.To="info@aa-premium.com"
  132. 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."
  133. myMail.Configuration.Fields.Item _
  134. ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
  135. 'Name or IP of remote SMTP server
  136. myMail.Configuration.Fields.Item _
  137. ("http://schemas.microsoft.com/cdo/configuration/smtpserver") _
  138. ="mail.aa-premium.com"
  139. 'Server port
  140. myMail.Configuration.Fields.Item _
  141. ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") _
  142. =25
  143. myMail.Configuration.Fields.Update
  144. myMail.Send
  145. set myMail=nothing
  146. %>
Last edited by peter_budo; Mar 22nd, 2008 at 4:31 pm. Reason: Keep It Organized - please use [code] tags
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the ASP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC