Ask a Question related to Coldfusion Database Access, Design and Development.
-
JoyRose #1
update and insert query error, but select works ok.
:rose;
Any ideas spring to mind about the following issue?
I'm getting an error trying to run an Update or Insert query. I can run a
Select query in the application, but not Insert or Update.
The Update and Insert queries works with SQL Query Analyzer.
Thanks.
<cfquery name="qUpSite" datasource="#request.optomDS#">
insert into optomSite
(SiteName)
VALUES('ThirdSite')
</cfquery>
<cfquery name="qUpSite" datasource="#request.optomDS#">
update optomSite
SET SiteName='TestSite'
where siteID = 1
</cfquery>
<cfquery name="qUpSite" datasource="#request.optomDS#">
SELECT *
FROM optomSite
where siteID = 1
</cfquery>
JoyRose Guest
-
HELP SQL Update syntax error in windows2003 but works fine in NT4???
We upgraded our production server to windows 2003 and have been seeing this error when trying to update the database through a cfquery tag: ODBC... -
CF_SQL_BIT works on Insert, not on Update
Aaarrgghhh! For some reason, insert and update Stored Procedures are behaving differently, and there is not discernable reason for it. Here are... -
IIF in Select Query Error
Hello, I need to create a query with a date calculation of elapsed minutes. And, I have made this work. Now I find that some of the... -
trying to update a table after making a join select query on two tables
here is my problem distilled down I need to be able to change the title of a book associated with an author there are 2 tables "author" and "books"... -
Use a SELECT @@IDENTITY as a sub-query in an UPDATE ?
It didn't work. UPDATE tblBlogs SET link_ID = blog_ID WHERE blog_ID = @@IDENTITY I get this error when trying to save an Access query: ... -
Kronin555 #2
Re: update and insert query error, but select works ok.
Your queries look fine. What's the error you're getting?
Also, just to cut back on the ping-pong questions and incase it's relevant
once you post the error:
what database?
what datatypes are those columns?
Kronin555 Guest
-
JoyRose #3
Re: update and insert query error, but select works ok.
Thanks for replying.
Part of the problem is I'm not getting a useful error:
12:06:01.001 - Database Exception - in
F:\DEV\Internet\Misc\JHolman\Optometry_db\optomAdm in\act_data2db.cfm : line 14
Error Executing Database Query.
SQL Server
siteID type = int (automatic identity column, primary key)
siteName type= varchar, length 100 ( no nulls allowed)
Like I said, the queries run fine in SQL Query Analyzer. The table is updated,
no problem.
Thanks for whatever insights you can offier!
JoyRose Guest
-
mxstu #4
Re: update and insert query error, but select works ok.
In the CF administrator, check Enable Robust Exception Information and any other database options so that the error message will provide more information.
mxstu Guest
-
Kronin555 #5
Re: update and insert query error, but select works ok.
Are you allowing Update and Insert statements to be executed for that
datasource? I've never disabled those, so I don't know if Coldfusion would give
you a nicer error message or not...
Also, do what mxstu said. Enable Robust Exception Information and also check
Exception Information further down on that page.
Kronin555 Guest
-
JoyRose #6
Re: update and insert query error, but select works ok.
I'm checking with the web server admin on that.
Another thing, but I don't think it could be related:
I've got security set up in the app. I use a cfif statement checking for
IsUserInRole(2) in the index page.
Everything else in the app works and the insert and update queries are called
into the index page. I also
tried the insert and update queries right after the security check and they
still don't work.
JoyRose Guest
-
mxstu #7
Re: update and insert query error, but select works ok.
Yes. Check the datasource options that Kronin555 mentioned. Make sure
INSERT and UPDATE are checked in the "Allow SQL" section. If those options
are unchecked (ie. disallowed), CF will usually give you a message like:
"Error Executing Database Query.
Executing the SQL statement is not allowed. "
mxstu Guest
-
JoyRose #8
Re: update and insert query error, but select works ok.
I just noticed your question about allowing Update and Insert to be executed
for that datasource. That would be set by the SQL DBA, right? Would the SQL
Query Analyzer update the table if Update and Insert weren't allowed for the
datasource? Or are datasource permissions set in Cold Fusion Admin?
JoyRose Guest
-
mxstu #9
Re: update and insert query error, but select works ok.
No. You can set allowed sql operations in the CF Administrator. It is high
level and essentially allows you to say "do not allow ANY insert operations
for this datasource...." or ... "allow insert, delete and update operations
only".
Another possibility is that the account used to define the datasource has the
wrong the wrong database permissions. Did you test your queries in the query
analyzer using the same account used for the CF datasource?
There are a few possibilities but I would look at the detailed error message
first. It will tell you what the problem is.
mxstu Guest
-
JoyRose #10
Re: update and insert query error, but select works ok.
I didn't have permission through ColdFusion Admin.
All better. :+>
Thanks for your help everyone!!
Make sure INSERT and UPDATE are checked in the "Allow SQL" section. If those
options are unchecked (ie. disallowed), CF will usually give you a message like:
JoyRose Guest



Reply With Quote

