User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ColdFusion section within the Web Development category of DaniWeb, a massive community of 397,786 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,381 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ColdFusion advertiser:
Views: 4633 | Replies: 1 | Solved
Reply
Join Date: Apr 2006
Posts: 29
Reputation: Stewie is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
Stewie Stewie is offline Offline
Light Poster

SQL Delete/Update Error

  #1  
Jun 11th, 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

<cfsetting showdebugoutput="yes">
<!--check to see if we are deleting recrod-->
<cfif (IsDefined('form.delete') and Trim(form.delete) EQ "Delete")>
<!--query to delete record by ID-->
<cfquery name="DeleteBusRecord" datasource="Rumors_Forms">
				 DELETE FROM BusTable
				 WHERE ID = #ID#
</cfquery>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Rumors Bar & Grill | Review Entry</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="style.css" type="text/css">

<body>


	<div id="page">
	
    <div id="header"><img src="Images/top3.jpg"></div>
			    
        	
    <div id="nav" bordercolor="ffffff"> <cfinclude template="navigation.cfm"> </div>
			    	
    	   	
    <div id="content" valign="top"> 
    <br>
				<h1>The Record has been deleted!</h1>
    </div>
		    	    
    <div id="right" valign="top">and here is extra, maybe an ad or something</div>
		
		<!--<div id="footer">copyright and what not</div>-->
		
	</div>
</body>
</html>

<cfelse>
<!-- If bus is not booked insert into DB using the following query -->
<cfquery name="UpdateBus" datasource="Rumors_Forms">
				 UPDATE BusTable
				 SET 	Name='#form.Name#',
				 		 Req_Date='#form.Month#/#form.Day#/form.Year#',
						 Req_Time='#form.Req_Time#',
						 Address='#form.Address#',
						 Email='#form.Email#',
						 PhoneNumber='#form.PhoneNumber#',
						 Reason='#form.Reason#'
				WHERE ID =#form.ID#
</cfquery>


<!-- query to select updated record -->
<cfquery name="GetBusRecord" datasource="Rumors_Forms">
	SELECT ID, Name, Req_Date, Req_Time, Address, Email, PhoneNumber, Reason
	FROM BusTable
	WHERE ID =#form.ID#
</cfquery>
<!-- Mail resuts to myself and form.email -->
<cfmail query="GetBusRecord"
				from="donotreply@rumorssportsbar.com"
				to="#form.Email#"
				bcc="ericstauss@gmail.com"
				subject="Bus reservation update
				type="html">

				<table border="1" cellpadding="0">
				 <tr><h3>Here are the details...</h3></tr>
				 <tr>
				 		 <th>Confirmation Number</th>
						 <th>Name</th>
						 <th>Date</th>
						 <th>Time</th>
						 <th>Address</th>
						 <th>E-mail</th>
						 <th>Phone Number</th>
						 <th>Purpose of Rental</th>
				 </tr>
				 
				 <tr>
				 		 <td>#ID#</td>
						 <td>#Name#</td>
						 <td>#Req_Date#</td>
						 <td>#Req_Time#</td>
						 <td>#Address#</td>
						 <td>#Email#</td>
						 <td>#PhoneNumber#</td>
						 <td>#Reason#</td>
				 </tr>								
</cfmail>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Rumors Bar & Grill | Review Entry</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="style.css" type="text/css">

<body>


	<div id="page">
	
    <div id="header"><img src="Images/top3.jpg"></div>
			    
        	
    <div id="nav" bordercolor="ffffff"> <cfinclude template="navigation.cfm"> </div>
			    	
    	   	
    <div id="content" valign="top"> 
				 <br>
				 <table border="1" cellpadding="0">
				 <h3>Here are the details...</h3>
				 
				 <tr>
				 		 <th>Confirmation Number</th>
						 <th>Name</th>
						 <th>Date</th>
						 <th>Time</th>
						 <th>Address</th>
						 <th>E-mail</th>
						 <th>Phone Number</th>
						 <th>Purpose of Rental</th>
				 </tr>
				 <cfoutput query="GetBusRecord">
				 <tr>
				 		 <td>#ID#</td>
						 <td>#Name#</td>
						 <td>#Req_Date#</td>
						 <td>#Req_Time#</td>
						 <td>#Address#</td>
						 <td>#Email#</td>
						 <td>#PhoneNumber#</td>
						 <td>#Reason#</td>
				 </tr>
				 </cfoutput>	
				 </table>
    </div>
		    	    
    <div id="right" valign="top">and here is extra, maybe an ad or something</div>
		
		<!--<div id="footer">copyright and what not</div>-->
		
	</div>
</body>
</html>
</cfif>

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

Thanks
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Apr 2006
Posts: 29
Reputation: Stewie is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
Stewie Stewie is offline Offline
Light Poster

Re: SQL Delete/Update Error

  #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  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb ColdFusion Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the ColdFusion Forum

All times are GMT -4. The time now is 5:15 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC