SQL Delete/Update Error

Thread Solved

Join Date: Apr 2006
Posts: 30
Reputation: Stewie is an unknown quantity at this point 
Solved Threads: 0
Stewie Stewie is offline Offline
Light Poster

SQL Delete/Update Error

 
0
  #1
Jun 12th, 2006
I keep getting this error when ever I try to update or delete a record from my site. The error that I keep getting is "The string is not closed" I have use an example straight from the book so I don't know where to go. Here is my code

  1. <cfsetting showdebugoutput="yes">
  2. <!--check to see if we are deleting recrod-->
  3. <cfif (IsDefined('form.delete') and Trim(form.delete) EQ "Delete")>
  4. <!--query to delete record by ID-->
  5. <cfquery name="DeleteBusRecord" datasource="Rumors_Forms">
  6. DELETE FROM BusTable
  7. WHERE ID = #ID#
  8. </cfquery>
  9.  
  10. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  11. <html>
  12. <head>
  13. <title>Rumors Bar & Grill | Review Entry</title>
  14. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  15. <link rel="stylesheet" href="style.css" type="text/css">
  16.  
  17. <body>
  18.  
  19.  
  20. <div id="page">
  21.  
  22. <div id="header"><img src="Images/top3.jpg"></div>
  23.  
  24.  
  25. <div id="nav" bordercolor="ffffff"> <cfinclude template="navigation.cfm"> </div>
  26.  
  27.  
  28. <div id="content" valign="top">
  29. <br>
  30. <h1>The Record has been deleted!</h1>
  31. </div>
  32.  
  33. <div id="right" valign="top">and here is extra, maybe an ad or something</div>
  34.  
  35. <!--<div id="footer">
  36. copyright and what not</div>-->
  37.  
  38. </div>
  39. </body>
  40. </html>
  41.  
  42. <cfelse>
  43. <!-- If bus is not booked insert into DB using the following query -->
  44. <cfquery name="UpdateBus" datasource="Rumors_Forms">
  45. UPDATE BusTable
  46. SET Name='#form.Name#',
  47. Req_Date='#form.Month#/#form.Day#/form.Year#',
  48. Req_Time='#form.Req_Time#',
  49. Address='#form.Address#',
  50. Email='#form.Email#',
  51. PhoneNumber='#form.PhoneNumber#',
  52. Reason='#form.Reason#'
  53. WHERE ID =# form.ID#
  54. </cfquery>
  55.  
  56.  
  57. <!-- query to select updated record -->
  58. <cfquery name="GetBusRecord" datasource="Rumors_Forms">
  59. SELECT ID, Name, Req_Date, Req_Time, Address, Email, PhoneNumber, Reason
  60. FROM BusTable
  61. WHERE ID =# form.ID#
  62. </cfquery>
  63. <!-- Mail resuts to myself and form.email -->
  64. <cfmail query="GetBusRecord"
  65. from="donotreply@rumorssportsbar.com"
  66. to="# form.Email#"
  67. bcc="ericstauss@gmail.com"
  68. subject="Bus reservation update
  69. type="html">
  70.  
  71. <table border="1" cellpadding="0">
  72. <tr><h3>Here are the details...</h3></tr>
  73. <tr>
  74. <th>Confirmation Number</th>
  75. <th>Name</th>
  76. <th>Date</th>
  77. <th>Time</th>
  78. <th>Address</th>
  79. <th>E-mail</th>
  80. <th>Phone Number</th>
  81. <th>Purpose of Rental</th>
  82. </tr>
  83.  
  84. <tr>
  85. <td># ID#</td>
  86. <td># Name#</td>
  87. <td># Req_Date#</td>
  88. <td># Req_Time#</td>
  89. <td># Address#</td>
  90. <td># Email#</td>
  91. <td># PhoneNumber#</td>
  92. <td># Reason#</td>
  93. </tr>
  94. </cfmail>
  95.  
  96. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  97. <html>
  98. <head>
  99. <title>Rumors Bar & Grill | Review Entry</title>
  100. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  101. <link rel="stylesheet" href="style.css" type="text/css">
  102.  
  103. <body>
  104.  
  105.  
  106. <div id="page">
  107.  
  108. <div id="header"><img src="Images/top3.jpg"></div>
  109.  
  110.  
  111. <div id="nav" bordercolor="ffffff"> <cfinclude template="navigation.cfm"> </div>
  112.  
  113.  
  114. <div id="content" valign="top">
  115. <br>
  116. <table border="1" cellpadding="0">
  117. <h3>Here are the details...</h3>
  118.  
  119. <tr>
  120. <th>Confirmation Number</th>
  121. <th>Name</th>
  122. <th>Date</th>
  123. <th>Time</th>
  124. <th>Address</th>
  125. <th>E-mail</th>
  126. <th>Phone Number</th>
  127. <th>Purpose of Rental</th>
  128. </tr>
  129. <cfoutput query="GetBusRecord">
  130. <tr>
  131. <td># ID#</td>
  132. <td># Name#</td>
  133. <td># Req_Date#</td>
  134. <td># Req_Time#</td>
  135. <td># Address#</td>
  136. <td># Email#</td>
  137. <td># PhoneNumber#</td>
  138. <td># Reason#</td>
  139. </tr>
  140. </cfoutput>
  141. </table>
  142. </div>
  143.  
  144. <div id="right" valign="top">and here is extra, maybe an ad or something</div>
  145.  
  146. <!--<div id="footer">copyright and what not</div>-->
  147.  
  148. </div>
  149. </body>
  150. </html>
  151. </cfif>

It highlights this line "Reason='#form.Reason#'" from my update query as the problem. Any help would be great.

Thanks
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 30
Reputation: Stewie is an unknown quantity at this point 
Solved Threads: 0
Stewie Stewie is offline Offline
Light Poster

Re: SQL Delete/Update Error

 
0
  #2
Jun 16th, 2006
I found the problem.
I was missing a #sign in
Req_Date='#form.Month#/#form.Day#/form.Year#'
simple little mistakes
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the ColdFusion Forum
Thread Tools Search this Thread



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

©2003 - 2009 DaniWeb® LLC