Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I run SQL query typed in TextArea in ColdFusion forms?

Status
Not open for further replies.

leekikwan

Programmer
Nov 21, 2003
10
0
0
US
What I want to do is that when user type in the sql query in textarea box, it is excuted in the next page. I have tried as follows. It is working when I run select SQL statement. However, when I run update or insert SQL statement, I get "The page cannot be displayed. HTTP 500 - Internal server error" Anyone tell me why and how to overcome this?

sqlrun.cfm

<form method="POST" ACTION = "sqlrun_fin.cfm">
<table width="426" border="0" cellspacing="0">
<tr bgcolor="#0000FF">
<td width="424" height="21"><strong><font color="#FFFF66" size="2" face="Arial, Helvetica, sans-serif">SQL</font></strong></td>
</tr>
<tr bordercolor="#FFFF99">
<td><textarea name="mysql" cols="65" rows="5"></textarea>
</td>
</tr>
</table>
<table width="429" border="0">
<tr>
<td width="191"><input type="submit" name="Submit" value="Submit"></td>
</tr>
</form>

sqlrun_fin.cfm

<cfquery NAME = "srun" datasource="scm">
#FORM.MYSQL#
</cfquery>
<h1 class="style1">SQL Run Completed!!

 
try
<cfquery NAME = "srun" datasource="scm">
#preservesinglQuotes(FORM.MYSQL)#
</cfquery>
<h1 class="style1">

A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.
-Douglas Adams (1952-2001)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top