Cfquery error
Hi Folks,
Having recently upgraded to CF 7, I'm getting loads of errors
saying password and username undefined in the cfquery tag.
Are these attributes necessary with cfquery in CF 7?
Isnt there a security risk by not including them?
Thankyou
Set up your datasources on your admin page and you don't have
to worry about it. The information is also more secure there than
in your source code.
Similar Messages
-
Syntax error in INSERT STATEMENT
A problem on the date part of the query but why I don´t
know, Thanks for any pointers,
TIA
<cfquery name="update1" datasource="trevor_SecurityDB">
INSERT INTO imagesproducts
(title, info, date)
VALUES ( '#form.title#', '#form.info#', '#DateFormat(Now())#'
</cfquery>
Error Occurred While Processing Request
Error Executing Database Query.
[Macromedia][SequeLink JDBC Driver][ODBC
Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error in
INSERT INTO statement.
The error occurred in uploadmember.cfm: line 28
26 : INSERT INTO imagesproducts
27 : (title, info, date)
28 : VALUES ( '#form.title#', '#form.info#',
'#DateFormat(Now())#' )
29 : </cfquery>
30 :
SQL INSERT INTO imagesproducts (title, info, date) VALUES (
'News test', 'Testing news info', '12-Jul-07' )
DATASOURCE trevor_SecurityDB
VENDORERRORCODE -3502
SQLSTATE 42000Perhaps it is a reserved word issue with the date column,
since
date is an ODBC Reserved Keyword. You might try enclosing it
within brackets [ ].
<cfquery name="update1" datasource="trevor_SecurityDB">
INSERT INTO imagesproducts
(title, info, [date])
VALUES ( '#form.title#', '#form.info#', '#DateFormat(Now())#'
</cfquery>
Or, if that doesn't help, you might try using a cfqueryparam
tag for the '#DateFormat(Now())#' value using a cfsqltype =
"CF_SQL_TIMESTAMP" (assuming a date/time datatype on the column).
Also, you might look into using one of the CreateODBCDateTime() or
CreateODBCDate() functions.
Phil -
what am I doing wrong ? My code is below and so is the error,
blowing up on Substring
<cfquery name="qryGet_MMI_Data_1" datasource="MMI_db">
Select *
from tblMMI_Header,tblMMI_Items_1
where tblMMI_Header.service_req_no =
tblMMI_Items_1.service_req_no
and tblMMI_Header.hold_status_flag = 'No'
and substring(tblMMI_Header.move_coordinator,1,6) <>
'Vendor'
and tblMMI_Header.move_date between
#CreateODBCDate(session.start_date)# and
#CreateODBCDate(session.end_date)#
</cfquery>
Error Occurred While Processing Request
Error Diagnostic Information
ODBC Error Code = 37000 (Syntax error or access violation)
[Microsoft][ODBC Microsoft Access Driver] Undefined function
'substring' in expression.
SQL = "Select * from tblMMI_Header,tblMMI_Items_1 where
tblMMI_Header.service_req_no = tblMMI_Items_1.service_req_no and
tblMMI_Header.hold_status_flag = 'No' and
substring(tblMMI_Header.move_coordinator,1,6) <> 'Vendor' and
tblMMI_Header.move_date between {d '2006-05-20'} and {d
'2006-05-20'}"
Data Source = "MMI_DB"
The error occurred while processing an element with a general
identifier of (CFQUERY), occupying document position (142:1) to
(142:54) in the template file
D:\webserve\esscm\pages\logistics\estrans\cost_center_detail_report.cfm.
Date/Time: 05/18/06 15:03:08
Browser: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;
SV1; .NET CLR 1.0.3705)
Remote Address: 147.16.33.158
HTTP Referer:
http://rww.sas.ray.com/esscm/pages/logistics/estrans/cost_center_detail_date_selection.cfmDoes access have a substring function that is named
substring? The error message suggests not. I don't use access so I
don't actually know. -
Frustrating syntax error:cfqueryparam
I must be brain dead. I have been looking at this code for about 45 minutes trying to figure out where the syntax error is. I think it is in one of the "," but I have rearranged them so many times I am going bonkers. Can someone find where my error is.
<cfquery name="addRegistration" datasource="RBDS">
INSERT INTO
tournamentReg
(tDate
,tName
,regDateTime
,regNumber
,regFName
,regLName
,streetAddr
,cityStateZip
,regPhone
,regEmail
,lastBook
,usbcCard
,regNotify
,regReturn
,regMembership
,regLeague
<cfif tName EQ #URL.tName# AND 'doubles' IS 'yes'>
BowlerTwoName, BowlerTwoBook
</cfif>
<cfif tName EQ #URL.tname# AND 'threePerTeam' is 'yes'>
BowlerTwoName, BowlerTwoBook,
BowlerThreeName, BowlerThreeBook
</cfif>
<cfif tName EQ #URL.tname# AND 'fourPerTeam' IS 'yes'>
BowlerTwoName, BowlerTwoBook,
BowlerThreeName, BowlerThreeBook,
BowlerFourName, BowlerFourBook
</cfif>
<cfif tName EQ #URL.tname# AND 'fivePerTeam' IS 'yes'>
BowlerTwoName, BowlerTwoBook,
BowlerThreeName, BowlerThreeBook,
BowlerFourName, BowlerFourBook,
BowlerFiveName, BowlerFiveBook
</cfif>)
VALUES
VALUES
<cfif tName EQ #URL.tname# AND 'doubles' IS 'yes'>
<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerTwoName#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerTwoBook#">
</cfif>
<cfif tName EQ #URL.tname# AND 'threePerTeam' is 'yes'>
<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerTwoName#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerTwoBook#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerThreeName#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerThreeBook#">
</cfif>
<cfif tName EQ #URL.tname# AND 'fourPerTeam' IS 'yes'>
<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerTwoName#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerTwoBook#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerThreeName#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerThreeBook#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerFourName#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerFourBook#">
</cfif>
<cfif tName EQ #URL.tname# AND 'fivePerTeam' IS 'yes'>
<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerTwoName#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerTwoBook#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerThreeName#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerThreeBook#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerFourName#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerFourBook#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerFiveName#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.BowlerFiveBook#">
</cfif>
,<cfqueryparam cfsqltype="CF_SQL_DATE" value="#URL.tdate#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#URL.tname#">
,<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.regDateTime#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#URL.regNumber#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regFName#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regLName#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.streetAddr#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.cityStateZip#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regPhone#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regEmail#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.lastBook#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.usbcCard#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regNotify#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regReturn#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regMembership#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regLeague#">
</cfquery>
Error Dump states the error is on line 151 (above). Until I added the <cfif>'s it worked fine. BTW- the <cfif>'s work find until it processes the VALUE.
Error Executing Database Query.
[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
The error occurred in C:\Inetpub\wwwroot\renobowls\forms\ProcessRegistration.cfm: line 151
Called from C:\Inetpub\wwwroot\renobowls\forms\ProcessRegistration.cfm: line 29
Called from C:\Inetpub\wwwroot\renobowls\forms\ProcessRegistration.cfm: line 28
Called from C:\Inetpub\wwwroot\renobowls\forms\ProcessRegistration.cfm: line 1
Called from C:\Inetpub\wwwroot\renobowls\forms\ProcessRegistration.cfm: line 151
Called from C:\Inetpub\wwwroot\renobowls\forms\ProcessRegistration.cfm: line 29
Called from C:\Inetpub\wwwroot\renobowls\forms\ProcessRegistration.cfm: line 28
Called from C:\Inetpub\wwwroot\renobowls\forms\ProcessRegistration.cfm: line 1
149 : <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regReturn#">,
150 : <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regMembership#">,
151 : <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regLeague#">
152 :
153 : )Hey Dan. Thanks for the tips yesterday. I went back to the version of the code when it worked. The working code is at the top. The non-working code is at the bottom. It starts not working when I include the CFIF's. I am not sure I understand your other suggestion. But maybe if you take a look at the difference between the working code and the other you can see what I don't.
Working CODE:
<cfquery name="addRegistration" datasource="RBDS">
INSERT INTO
tournamentReg
(tDate
,tName
,regDateTime
,regNumber
,regFName
,regLName
,streetAddr
,cityStateZip
,regPhone
,regEmail
,lastBook
,usbcCard
,regNotify
,regReturn
VALUES
<cfqueryparam cfsqltype="CF_SQL_DATE" value="#URL.tdate#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#URL.tname#">
,<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.regDateTime#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#URL.regNumber#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regFName#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regLName#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.streetAddr#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.cityStateZip#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regPhone#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regEmail#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.lastBook#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.usbcCard#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regNotify#">
,<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regReturn#">
</cfquery>
PRODUCES THIS:
CONGRATULATIONS YOU ARE NOW REGISTERED FOR THE
SUPER NO-TAP
WHO TO CONTACT: Rick Rossiter - TELEPHONE: 775-813-5492
The table below contains all of the information you entered for the Super No-Tap tournament.
All the information you entered to register for this tournament is displayed bwlow. Reno Bowls wishes you the best of luck in this tournament. If there is any information below that is incorrect, please inform us as soon as possible by calling Reno Bowls or sending us an email to: [email protected]. Please make certain to include your registration number (8701967) when making any inquiries.
YOUR REGISTRATION NUMBER
8701967
TIME AND DATE YOU REGISTERED
02/17/10 - 1:02:09 PM
DATE OF TOURNAMENT
2009-12-13 00:00:00.0
WHERE THE TOURNAMENT WILL BE
High Sierra Bowling Lanes
3390 South Virginia Street
Reno, NV, 89502-4502
(775) 825-1048
DIRECTONS
TIME TOURNAMENT BEGINS
12:00 PM
YOU SAVED $5.00 BY REGISTERING ONLINE
$25
CAPTAIN'S NAME (FIRST REGISTRANT)
Rick Rossiter
YOUR MAILING ADDRESS:
105 N. McCarran Blvd.
Reno, NV 89523
YOUR EMAIL ADDRESS IS:
[email protected]
YOUR PHONE NUMBER IS:
813-0850
YOUR LAST YEARS BOOK AVERAGE IS:
191
YOUR USBC MEMBER NUMBER IS:
8130-5041
NOTIFY YOU OF FUTURE TOURNAMENTS
Yes
RETURNING RENO BOWLS PLAYER
welcome back and thank you
Reno Bowls, A NexTeam LLC Company (c) 2009-2010
The NON-WORKING CODE: Even though I removed the CFIF structure. However, I have to be able to discern the number of bowlers according to the tournament the registrant is entering.
<cfquery name="addRegistration" datasource="RBDS">
INSERT INTO
tournamentReg
(tDate
,tName
,regDateTime
,regNumber
,regFName
,regLName
,streetAddr
,cityStateZip
,regPhone
,regEmail
,lastBook
,usbcCard
,regNotify
,regReturn
,regMembership
,regLeague
VALUES
<cfqueryparam cfsqltype="CF_SQL_DATE" value="#URL.tdate#">,
<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#URL.tname#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.regDateTime#">,
<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#URL.regNumber#">,
<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regFName#">,
<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regLName#">,
<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.streetAddr#">,
<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.cityStateZip#">,
<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regPhone#">,
<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regEmail#">,
<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.lastBook#">,
<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.usbcCard#">,
<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regNotify#">,
<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regReturn#">,
<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regMembership#">,
<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regLeague#">
</cfquery>
According to the dump the "," syntax is incorrect, but it looks fine to me. What am I missing?
Error Occurred While Processing Request
Error Executing Database Query.
[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
The error occurred in C:\Inetpub\wwwroot\renobowls\forms\ProcessRegistration.cfm: line 168
166 : <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regReturn#">,
167 : <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regMembership#">,
168 : <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.regLeague#">
169 :
170 : )
SQL
INSERT INTO tournamentReg (tDate ,tName ,regDateTime ,regNumber ,regFName ,regLName ,streetAddr ,cityStateZip ,regPhone ,regEmail ,lastBook ,usbcCard ,regNotify ,regReturn ,regMembership ,regLeague VALUES ( (param 1) , (param 2) , (param 3) , (param 4) , (param 5) , (param 6) , (param 7) , (param 8) , (param 9) , (param 10) , (param 11) , (param 12) , (param 13) , (param 14) , (param 15) , (param 16) )
DATASOURCE
RBDS
VENDORERRORCODE
-3502
SQLSTATE
42000 -
Accessing CFLOGIN Vars
I've got a basic CFLOGIN framework going to secure an application. Everything is working fine, except after they log in I need to query a database for to pull info for each user. I used to use session variables, set in the login script, to do this.
I'd like to user cflogin.name and cflogin.password to identify the correct DB record. But the Adobe documentation says "You can use these values in the cflogin tag body to authenticate the user, and, in the cfloginuser tag, to log the user in. The structure is only available in the cflogin tag body."
This seems like it defeats the point of using CFLOGIN, since the code between <cflogin> and </cflogin> only executes when a user IS NOT logged in. Does this mean that upon entering the correct user/pass, I have to also set a session variable to identify the user outside of the CFLOGIN tag? It seems redundant...
Anyone have an explanation/solution? Below is my query and error.
THANKS!
<cfquery datasource="DS" name="QName" username="username" password="password">
SELECT *
FROM table
WHERE username = #cflogin.name#
</CFQUERY>
Error: Element NAME is undefined in CFLOGIN.Accessing CFLOGIN Vars
I've got a basic CFLOGIN framework going to secure an application. Everything is working fine, except after they log in I need to query a database for to pull info for each user. I used to use session variables, set in the login script, to do this.
I'd like to user cflogin.name and cflogin.password to identify the correct DB record. But the Adobe documentation says "You can use these values in the cflogin tag body to authenticate the user, and, in the cfloginuser tag, to log the user in. The structure is only available in the cflogin tag body."
This seems like it defeats the point of using CFLOGIN, since the code between <cflogin> and </cflogin> only executes when a user IS NOT logged in. Does this mean that upon entering the correct user/pass, I have to also set a session variable to identify the user outside of the CFLOGIN tag? It seems redundant...
Anyone have an explanation/solution? Below is my query and error.
THANKS!
<cfquery datasource="DS" name="QName" username="username" password="password">
SELECT *
FROM table
WHERE username = #cflogin.name#
</CFQUERY>
Error: Element NAME is undefined in CFLOGIN. -
QoQ unsupported numeric type??
Hi,
Has anyone successfully used CF_Select from Masrizal? I
bought the code only
to find that it's not working with dynamic options.
Would appreciate suggestions on how to get this to work. TIA
THis error is coming from this code in the Tag.
<cfquery dbtype="query" name="qryTemp">
select * from qryTemp
order by parent
</cfquery>
Error Executing Database Query.
Query Of Queries runtime error.
Query Of Queries runtime error.
Unsupported Numeric type conversion in Query of Queries.
My Code:
<cfquery name="getPA" datasource="bibs2">
select PraticeArea, PraticeAreaID from bibs_tblPraticeArea
where DeleteFlag = 0 order by PraticeArea
</cfquery>
<cfquery name="getBibs" datasource="bibs2">
Select *
from bibs_tblBibliographies
where DeleteFlag = 0
Order by DateModified Desc
</cfquery>
<table border="0">
<form name="test" action="example.cfm" method="post">
<tr><td>Pratice Area</td>
<td>
<cf_select name="PraticeArea" formname="test"
passthrough="style='background-color:##000000;
color:##ffffff;'">
<cf_option value="">Select Pratice
Area</cf_option>
<cfoutput query="getpa">
<cf_option
value="#PraticeAreaID#">#PraticeArea#</cf_option>
</cfoutput>
</cf_select>
</td>
</tr>
<tr><td>Bibs</td>
<td>
<cf_select name="BiBs" parent="PraticeArea"
formname="test"
passthrough="style='background-color:##000000;
color:##ffffff;'">
<cf_option value="" parent="">Select
Bib</cf_option>
<cfoutput query="getBibs">
<cf_option value="#BIBSID#"
parent="#PraticeArea#">#Title#</cf_option>
</cfoutput>
</cf_select>
</td>
</tr>
<tr>
<td>
<br>
<input name="Submit" type="Submit">
</td>
</tr>
</form>
<!--- view posted form --->
<cfif isdefined("form.Submit")>
<tr>
<td >
<hr>
<cfoutput>
You have selected this:<br>
<cfloop collection="#form#" item="key">
<cfif key neq "fieldnames" and key neq "submit">
#Key#: #evaluate("form.#key#")#<br>
</cfif>
</cfloop>
</cfoutput>
</td>
</tr>
</cfif>
</table>Solution: #jsstringformat()#
Example:
<cf_select name="PraticeArea" formname="test"
passthrough="style='background-color:##000000;
color:##ffffff;'">
<cf_option value="">Select Pratice
Area</cf_option>
<cfoutput query="getpa">
<cf_option
value="#jsstringformati(PraticeAreaID)#">#PraticeArea#</cf_option>
</cfoutput>
</cf_select>
<cf_select name="BiBs" parent="PraticeArea"
formname="test"
passthrough="style='background-color:##000000;
color:##ffffff;'">
<cf_option value="" parent="">Select
Bib</cf_option>
<cfoutput query="getBibs">
<cf_option value="#jsstringformat(BIBSID)#"
parent="#jsstringformat(PraticeArea)#">#Title#</cf_option>
</cfoutput>
</cf_select>
thanks for all the respond!
"is" <[email protected]> wrote in message
news:[email protected]...
> Hi,
>
> Has anyone successfully used CF_Select from Masrizal? I
bought the code
only
> to find that it's not working with dynamic options.
> Would appreciate suggestions on how to get this to work.
TIA
>
> THis error is coming from this code in the Tag.
>
> <cfquery dbtype="query" name="qryTemp">
> select * from qryTemp
> order by parent
> </cfquery>
> Error Executing Database Query.
>
> Query Of Queries runtime error.
> Query Of Queries runtime error.
> Unsupported Numeric type conversion in Query of Queries.
>
>
>
>
>
>
>
> My Code:
> <cfquery name="getPA" datasource="bibs2">
> select PraticeArea, PraticeAreaID from
bibs_tblPraticeArea
> where DeleteFlag = 0 order by PraticeArea
> </cfquery>
>
> <cfquery name="getBibs" datasource="bibs2">
> Select *
> from bibs_tblBibliographies
> where DeleteFlag = 0
> Order by DateModified Desc
> </cfquery>
>
>
> <table border="0">
> <form name="test" action="example.cfm"
method="post">
> <tr><td>Pratice Area</td>
> <td>
> <cf_select name="PraticeArea" formname="test"
> passthrough="style='background-color:##000000;
color:##ffffff;'">
> <cf_option value="">Select Pratice
Area</cf_option>
> <cfoutput query="getpa">
> <cf_option
value="#PraticeAreaID#">#PraticeArea#</cf_option>
> </cfoutput>
> </cf_select>
> </td>
> </tr>
>
> <tr><td>Bibs</td>
> <td>
> <cf_select name="BiBs" parent="PraticeArea"
formname="test"
> passthrough="style='background-color:##000000;
color:##ffffff;'">
> <cf_option value="" parent="">Select
Bib</cf_option>
> <cfoutput query="getBibs">
> <cf_option value="#BIBSID#"
> parent="#PraticeArea#">#Title#</cf_option>
> </cfoutput>
> </cf_select>
> </td>
> </tr>
>
> <tr>
> <td>
> <br>
> <input name="Submit" type="Submit">
> </td>
> </tr>
> </form>
>
> <!--- view posted form --->
> <cfif isdefined("form.Submit")>
> <tr>
> <td >
> <hr>
> <cfoutput>
> You have selected this:<br>
> <cfloop collection="#form#" item="key">
> <cfif key neq "fieldnames" and key neq "submit">
> #Key#: #evaluate("form.#key#")#<br>
> </cfif>
> </cfloop>
> </cfoutput>
> </td>
> </tr>
> </cfif>
> </table>
>
>
>
>
>
> -
Displaying Time Problem w/MySQL CFMX7
Greetings -
Using
-- MySQL
-- CFMX7
I have a report designed which collects the time the report
was done. This
field is filled in by an individual. The form field is
validated for time entry.
On the insert query, the input is coded as:
--> #CreateODBCTime(form.ReportTime)#
MySQL DB Field:
--> Name: ReportTime
--> Type: Time
--> Format: HH:MM:SS
--> Default: <NULL>
When I look at the individual record in DB I see the time as:
--> 15:21:00
When I output the time on a page (without formatting) I get
this:
--> {ts '1970-01-01 00:00:00'}
When I output the time on a page (with formatting) I get
this:
--> 00:00:00
What am I doing wrong? What am I missing?
Leonard BHi MikeRoo,
Below is the MySQL Version, query code and error message
received.
I am sure it is something I am doing wrong or simply having a
brain
moment.
Leonard B
MySQL Version: 4.1.10a
========== CFQUERY CODING ==========
<cfquery name="qGetTime" datasource="nwbizsql01">
SELECT RecID, TimeOne
CAST (TimeOne AS CHAR (15)) AS TimeStr
FROM nwbizsql01.time_testing
WHERE RecID = 4
</cfquery>
========== ERROR MESSAGE ==========
Error Executing Database Query.
[Macromedia][SequeLink JDBC Driver][ODBC Socket]You have an
error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near '(TimeOne AS
CHAR (15)) AS TimeStr FROM nwbizsql01.time_testing WHERE RecID = 4'
at line 1
The error occurred in
C:\Inetpub\wwwroot\nw-biz\mysql_time_test.cfm: line 3
1 : <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 :
3 : <cfquery name="qGetTime" datasource="nwbizsql01">
4 : SELECT RecID, TimeOne
5 : CAST (TimeOne AS CHAR (15)) AS TimeStr
SQL SELECT RecID, TimeOne CAST (TimeOne AS CHAR (15)) AS
TimeStr FROM nwbizsql01.time_testing WHERE RecID = 4
DATASOURCE nwbizsql01
VENDORERRORCODE 1064
SQLSTATE 23000
Please try the following:
Check the ColdFusion documentation to verify that you are
using the correct syntax.
Search the Knowledge Base to find a solution to your problem.
Browser Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1;
Maxthon; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
Remote Address 127.0.0.1
Referrer
Date/Time 24-May-06 11:33 AM
Stack Trace (click to expand) -
Can someone point me in the right direction as to what type
of code I should try using? I need to add up some totals from
different tables in the database.
I have the following table structure, they have a lot more
fields but I will add the important ones:
Table: associates
Fields: id, assoc_id, initials, hourlyrate
Table: caseactivity
Fields: id, assoc_id, descripofservice, initials, hoursworked
I am outputing all of my data from "caseactivity", but at the
bottom of that I need to find a way to total up the hoursworked and
get a total cost for the hours worked based on the initials of the
person that entered the info. There will be different hourlyrate's
I need to pull from the associates table. So I'm not sure how to
add up. Any help in the right direction would be appreciated.
Thanks!Thank you very much for the help, I think I see what the code
is doing now.
I changed the code to this and I get an error:
<cfquery name="qinitials" datasource="mydb">
SELECT * FROM associates WHERE assoc_id = #session.assoc_id#
</cfquery>
<cfquery name="qtime" datasource="mydb">
select hourlyrate, initials, sum(hoursworked) * hourlyrate as
totalcost
from associates a join caseactivity c on a.assoc_id =
c.assoc_id
where initials = #qinitials.initials#
</cfquery>
Error:
Column 'initials' in field list is ambiguous
26 : where initials = #qinitials.initials# -
Creation of triggers using CFQUERY tag is giving error
Hi,
I am creating triggers and stored procedure on ORACLE data
base using <CFQUERY>.
<CFQUERY DATASOURCE="CRM">
create or replace trigger AWC_ACCOUNTINGPERIODSID_TRI
before insert on AWC_ACCOUNTINGPERIODS
for each row
begin
select AWC_ACCOUNTINGPERIODSID_SEQ.nextval into :new.AP_ID
from dual;
end;
</CFQUERY>
But the created trigger is not compiled, it is giving the
following error
"Line # = 1 Column # = 6 Error Text = PLS-00103: Encountered the
symbol "" when expecting one of the following: begin case declare
exit for goto if loop mod null pragma raise return select update
while with <an identifier> << close current delete
fetch lock insert open rollback savepoint set sql execute commit
forall merge pipe The symbol "" was ignored."
If I edit that trigger in enterprise manager console by
pressing space and compile that, it is working fine with out any
error. If i run the above statement in sql *plus, It is working
fine with out any error. Can you please tell me why this is
happening if i run it using cfquery tag and also the possible
solutions.
Thanks in advance,
VinodI can't tell you why your particular trigger is failing, but
here is some "typical" reasons from Oracle's metalink.
Common reasons for PLS-00103
Error Summary
PLS-00103 Encountered the symbol "%s" when expecting one of
the following (Oerr
LS.103)
Error Details
~~~~~~~~~~~~~
Error: PLS-00103
Text: Encountered the symbol "%s" when expecting one of the
following:
Cause: This error message is from the parser. It found a
token
(language element) that is inappropriate in this context.
Action: Check previous tokens as well as the one given in the
error message. The line and column numbers given in the
error
message refer to the end of the faulty language construct.
PLS-00103 errors can often be difficult to localize what the
error is so here are some
common reasons for PLS-00103 errors..
A very common reason for PLS-00103 is when a reserved word is
used, with a reserved word
means words that names an oracle object or a built in
procedure, for example MOD, ABS,
TABLE, VIEW etc..
When trying to use SQL*PLUS commands in PL/SQL procedures,
like SPOOL, SET and other
commands that belongs to SQL*PLUS can result in this error.
Using parameter declaration at the IN/OUT clause in a
procedure, this works in versions
prior to 8.0.4, but it just ignored the declaration.
Using DDL commands in PL/SQL will fail in PLS-00103, the way
to use DDL commands is
to build a procedure in dynamic sql.
When creating package specification and a package body, a
PLS-00103 error will occur
if there is no slash, '/', after the package specification.
Phil -
I am trying to use the attached code to insert records into a
table. BUT, it gives me the following error:
Error Executing Database Query.
[Macromedia][SequeLink JDBC Driver][ODBC
Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error
(missing operator) in query expression '[email protected]'.
The error occurred in
C:\ColdFusion8\wwwroot\silvereagles\manotify.cfm: line 94
92 : (rosterkey, eventnumber, playernumber, firstname,
lastname, emailaddr,
93 : notifieddate)
94 : VALUES (#matchkey#, #eventnumber#, #keymine#,
#playerfirst#, #playerlast#, #playeremail#, #today#)
95 : </cfquery>
96 : </cfif>
SQLSTATE 42000
SQL INSERT INTO matchroster (rosterkey, eventnumber,
playernumber, firstname, lastname, emailaddr, notifieddate) VALUES
(52, 5, 2, Art, Bushey, [email protected], {ts '2009-03-03
11:51:57'})
VENDORERRORCODE -3100
DATASOURCE connsilvereagles
If I remove the playerermail element (which has an @ in it)
it will insert without fail....this is happening on other scripts
as well for me......I have been on many forums seeking assistance
with this to no avail. Hopefully, someone in your organization will
be familiar with this issue.
Thanks in advanceYou really should use the <cfqueryparam> tag.
You can read more about it on ColdFusio's documentation
http://livedocs.adobe.com/coldfusion/8/htmldocs/Tags_p-q_18.html#1102474
See also:
http://www.adobe.com/devnet/coldfusion/articles/cfqueryparam.html
Massimo Foti, web-programmer for hire
Tools for ColdFusion, JavaScript and Dreamweaver:
http://www.massimocorner.com -
WDDX packet parse error when posting cfquery object
I am posting a hidden form attribute of a wddx encrypted
cfquery object to my action page. The data includes ampersands
'&'. I have verified that the data getting set to the form
variable has the ampersand encoded as '&' but when passed
to the next page the ampersand has already been decoded. There fore
I get the following error message when calling <cfwddx> with
an action="wddx2cfml": "WDDX packet parse error at line 1, column
1618. The entity name must immediately follow the '&' in the
entity reference.."
How can I make sure that the ampersand is encoded properly
before deseriealizing by query object?
Thanks,
JohnAre you certain the & were converted to & ? It
seems to work for me. -
Attribute validation error for tag CFQUERY
I have a CF application that's running fine on a shared host. I now have a VPS running version of CF 9. When I try to use this on the VPS, I get the following error:
Attribute validation error for tag CFQUERY.
The value of the attribute datasource, which is currently '', is invalid.
The datasource is being set in application.cfc, and again works just fine in the shared environment.
The only differences is the shared is running on Windows, and the VPS is Linux. Also, the Windows is running version 9,0,1,274733 and the Linux is 9,0,0,251028
Any help would be greatly appreciated.bbholdem wrote:
I have a CF application that's running fine on a shared host. I now have a VPS running version of CF 9. When I try to use this on the VPS, I get the following error:
Attribute validation error for tag CFQUERY.
The value of the attribute datasource, which is currently '', is invalid.
The cause of the error is obvious. Somewhere in your application, the cfquery tag is used as follows, with an empty string as datasource:
<cfquery datasource="">
</cfquery>
That is a mistake. The error message should tell you where that occurs. -
I have a form that is submitting a list of values, The insert
query worked fine until I needed a where clause in it and now it
bombs out. Here is the code, and help would be appreciative.well, i am not so sure you do...
first, you never mentioned your intention to check for
duplicate
records... hence i did not suggest how to do it best.
second, all you said was that your query does not work - and
i gave you
an exact reason why it didn't - your where clause in the
insert query.
third, my saying "the record does not exist yet" refers to
the record
you are inserting, not *any* record in your table. the one
you are
inserting (which means you are creating a new record) surely
does not
yet exist in your db. there could be ANOTHER record with
exactly the
same info you are inserting, true.
it will also be nice if you post your solution to your
problem instead
of just posting "i fixed it, nevermind"... when someone else
has a
similar problem they can then find your thread and have an
answer
instead of asking the same question again.
as for your trying to check for duplicate records, the way to
do it
would be to use a select query inside your loop first to
check if a
record with same data as in the loop's row exists, and if
that query
returns 0 rows, then run your insert query (definitely
without any where
clause).
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com -
Error while updating a record in MS Access
Im new to coldfusion and am running into a problem while
trying to update a record in a MS Access table.
I have a MS Access table where the primary key is a
auto-number long integer field named jobid.
I have an edit form where info can be changed then saved. A
hidden form field named jobid holds the records primary key field
value for the record being edited. When submitted this is what
happens:
I use a basic SQL UPDATE statement but I get the error "Data
type mismatch in criteria expression"
Some code:
<cfset nJobId=Int(Val(FORM.jobid))>
*dont know if i need the above line but using #FORM.jobid#
in the WHERE clause below didnt work either
<cfquery datasource="lrs">
UPDATE jobs SET
status='#FORM.status#',
offer='#FORM.offer#',
postdate="#CreateODBCDate(FORM.postdate)#",
jobtype=#FORM.jobtype#,
jobtitle='#FORM.jobtitle#',
..etc...
WHERE jobid=#nJobId#
The WHERE clause is where the error occurs with "Data type
mismatch in criteria expression"
After a few times with that i changed the where clause to
simply "WHERE jobid=1" as this record id does exist, but it has the
same error.
I then tried changing the where clause to
WHERE jobid=<cfqueryparam cfsqltype="cf_sql_bigint"
value="#FORM.jobid#">
and there it "appears" to work, but the record is not
actually updated. No changes are made to the table though no error
is thrown.
Im missing something here... why wont the record update
?The data type mismatch isn't necessarily in your where
clause. I'm guessing that it's the quotes around the create
odbcdate function.
use of cfqueryparam will solve a lot of these problems for
you. -
I have taken the cfdump for tmpqry and it shows all data for
the range ( No error at this step ) . But when we exceute this
dbquery we get below mentioned error .
<cfquery name="qry" dbtype="query" >
SELECT *
FROM tmpqry
ORDER BY #arguments.colSort# ASC
</cfquery>
senerio:
I am using createobject to create a reference for component
and call MDArraySort function in the cfc and getting this error .
'The system has attempted to use an undefined value, which
usually indicates a programming error, either in your code or some
system code.
Null pointer is undefined.... '
i am using this code in a cfc file.
<cffunction name="MDArraySort" Returntype="query"
access="public" >
<cfargument name="colArray" type="array"
required="true">
<cfargument name="colNames" type="string"
required="true">
<cfargument name="colSort" type="string"
required="true">
<cfargument name="sensorIDs" type="string"
required="true">
<cfscript>
var tmpqry = Querynew(arguments.colNames);
var qRow = QueryAddRow(tmpqry, Arraylen(arguments.colArray)
</cfscript>
<cfloop from="1" to="#Arraylen(arguments.colArray)#"
index="qRowIndex">
<cfscript>
sIndexinSensorIDs = colArray[qRowIndex]["SENSOR"]&"##";
Temp_readin_code =
colArray[qRowIndex]["READING_CODE"]&"##";
QuerySetCell(tmpqry, 'SENSOR', sIndexinSensorIDs,
qRowIndex);
QuerySetCell(tmpqry,
'TYPE',javacast('String',colArray[qRowIndex]["TYPE"]), qRowIndex);
QuerySetCell(tmpqry, 'TIMESTAMP2',
LSParseDateTime(colArray[qRowIndex]["TIMESTAMP2"]), qRowIndex);
QuerySetCell(tmpqry,
'ORDER_BY_PARAM',javacast('String',colArray[qRowIndex]["ORDER_BY_PARAM"]),
qRowIndex);
QuerySetCell(tmpqry, 'READING_CODE',Temp_readin_code ,
qRowIndex);
QuerySetCell(tmpqry,
'READING',javacast('String',colArray[qRowIndex]["READING"]),
qRowIndex);
QuerySetCell(tmpqry,
'PK_READING',javacast('String',colArray[qRowIndex]["PK_READING"]),
qRowIndex);
QuerySetCell(tmpqry,
'ALARM_STATUS',javacast('String',colArray[qRowIndex]["ALARM_STATUS"]),
qRowIndex);
QuerySetCell(tmpqry, 'DURATION',
javacast('String',colArray[qRowIndex]["DURATION"]), qRowIndex);
QuerySetCell(tmpqry,
'DESCRIPTION',javacast('String',colArray[qRowIndex]["DESCRIPTION"]),
qRowIndex);
</cfscript>
</cfloop>
<cfquery name="qry" dbtype="query" >
SELECT *
FROM tmpqry
ORDER BY #arguments.colSort# ASC
</cfquery>
<cfreturn qry >
</cffunction>
It is working fine for some date range and and getting above
mentioned error in sone situation .Hi All ,
Thank you for your support ,
Finally i have fix the issue using some changes in my
function in cfc .
<cffunction name="MDArraySort" Returntype="query"
access="public" >
<cfargument name="colArray" type="array"
required="true">
<cfargument name="colNames" type="string"
required="true">
<cfargument name="colSort" type="string"
required="true">
<cfargument name="sensorIDs" type="string"
required="true">
<cfscript>
//Declare variable collection used in function as local
--->
var tmpqry =
Querynew(arguments.colNames,"CF_SQL_VARCHAR,CF_SQL_VARCHAR,CF_SQL_DATE,CF_SQL_VARCHAR,CF_ SQL_VARCHAR,CF_SQL_VARCHAR,CF_SQL_VARCHAR,CF_SQL_VARCHAR,CF_SQL_VARCHAR,CF_SQL_VARCHAR");
var qRow = QueryAddRow(tmpqry,
Arraylen(arguments.colArray));
</cfscript>
<cfloop from="1" to="#Arraylen(arguments.colArray)#"
index="qRowIndex">
<cfscript>
// Populate the query table
QuerySetCell(tmpqry, 'SENSOR',
colArray[qRowIndex]["SENSOR"], qRowIndex);
QuerySetCell(tmpqry,
'TYPE',arguments.colArray[qRowIndex]["TYPE"], qRowIndex);
QuerySetCell(tmpqry, 'TIMESTAMP2',
LSParseDateTime(arguments.colArray[qRowIndex]["TIMESTAMP2"]),
qRowIndex);
QuerySetCell(tmpqry,
'ORDER_BY_PARAM',arguments.colArray[qRowIndex]["ORDER_BY_PARAM"],
qRowIndex);
QuerySetCell(tmpqry, 'READING_CODE',
colArray[qRowIndex]["READING_CODE"] , qRowIndex);
QuerySetCell(tmpqry,
'READING',arguments.colArray[qRowIndex]["READING"], qRowIndex);
QuerySetCell(tmpqry,
'PK_READING',arguments.colArray[qRowIndex]["PK_READING"],
qRowIndex);
QuerySetCell(tmpqry,
'ALARM_STATUS',arguments.colArray[qRowIndex]["ALARM_STATUS"],
qRowIndex);
QuerySetCell(tmpqry, 'DURATION',
arguments.colArray[qRowIndex]["DURATION"], qRowIndex);
QuerySetCell(tmpqry,
'DESCRIPTION',arguments.colArray[qRowIndex]["DESCRIPTION"],
qRowIndex);
</cfscript>
</cfloop>
<cfquery name="qry" dbtype="query" >
SELECT *
FROM tmpqry
ORDER BY #arguments.colSort# ASC
</cfquery>
<cfreturn qry >
</cffunction>
Rajesh
SCMS
India
Maybe you are looking for
-
Could you give me an example use of the NationalInstruments.Analysis.Dsp.SignalProcessing.Integrate method? I want to integrate a signal but I am not sure what to use for the boundary conditions (initialCondition and finalCondition).
-
Hi there Somebody knows how to change the Billing date to be in grey color?, I mean I need this field to be blocked to capture it in VF01 (VBRK-FKDAT). Thanks Regards Soraya
-
How do I disable the volume clicking sound?
I have been trying to disable the super-annoying sound that is played every time you change the volume using the Volume Up/Down keys (F11 and F12 on my MacBook Pro) I am running Windows 7 Pro SP1 with BootCamp v3.3 on a 32-bit Intel Core Duo P7550 2.
-
Hi experts, Is there any BAPI for Customer creation? I tried with BAPI_CUSTOMER_CREATFROMDATA1, but it doesn't have account group field and also reference customer is mandatory field.There are many fields are unavailable in that BAPI. Ple
-
Hi, I found a live streaming film that plays via realplayer. The only option available is Realplayer. However, unlike quicktime, there is no 'save as' option in realplayer. Therefore if I am not online I can't watch it. Is there any way to save the v