Ask a Question related to Coldfusion Database Access, Design and Development.
-
coryd218 #1
Query Works in ACCESS DB but not on Front End
Okay...i am trying to run a query to view people that are overdue in there
medical appts. i did the <cfoutput> in place of <cfquery> and ran the query in
ACCESS. It works and it shows the view that i want. however, i get the
following error:
Error Executing Database Query.
[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft
Access Driver] Too few parameters. Expected 1.
The error occurred in \\server_name\squadron_overdue.cfm: line 121
119 : <span class="style1"><br>
120 : </span>
121 : <cfquery name="GetOverdue" datasource="myDSN">
122 : SELECT name, rank, imm_stat, den_stat, den_class, pha_stat, lab_stat,
dna_stat, hiv_stat, action_items
123 : FROM Wing_Data
--------------------------------------------------------------------------------
SQL SELECT name, rank, imm_stat, den_stat, den_class, pha_stat, lab_stat,
dna_stat, hiv_stat, action_items FROM Wing_Data WHERE Wing_Data.Unit='43
COMMUNICATIONS SQ' And Wing_Data.PHA_stat="R" Or DEN_STAT="R" Or DEN_CLASS="R"
Or PHA_STAT="R" Or LAB_STAT="R" Or DNA_STAT="R" Or HIV_STAT="R";
DATASOURCE myDSN
VENDORERRORCODE -3010
SQLSTATE 07002
First i'm on a page that shows all records, overdue or not. Well i have a
button you click to view overdue records only. you click the button and it
takes you to the squadron_overdue.cfm page. Thats when the error obviously
occurs. Here's my query:
<cfquery name="GetMedical" datasource="myDSN">
SELECT name, rank, imm_stat, den_stat, den_class, pha_stat, lab_stat,
dna_stat, hiv_stat, action_items
FROM Wing_Data
WHERE Wing_Data.Unit='43 COMMUNICATIONS SQ' And Wing_Data.PHA_stat="R" Or
DEN_STAT="R" Or DEN_CLASS="R" Or PHA_STAT="R" Or LAB_STAT="R" Or DNA_STAT="R"
Or HIV_STAT="R";
</cfquery>
and here's my <cfoutput>: (the if statements change the information from the
database to the corresponding color: RED, YELLOW, OR GREEN) THATS WHAT THE SPAN
CLASSES ARE.)
<CFOUTPUT query="GetMedical">
<tr>
<td><span class="style34">#name#</span></td>
<td><span class="style34">#rank#</span></td>
<td><span class="style34"><cfif '#imm_stat#' eq "R"><span
class="style43"><cfelseif '#imm_stat#' eq "Y"><span class="style42"><cfelseif
'#imm_stat#' eq "g"><span class="style41">
</cfif>#imm_stat#</span></td>
<td><span class="style34"><cfif '#den_stat#' eq "R"><span
class="style43"><cfelseif '#den_stat#' eq "Y"><span class="style42"><cfelseif
'#den_stat#' eq "g"><span class="style41">
</cfif>#den_stat#</span></td>
<td><span class="style34"><cfif '#den_class#' eq "4"><span
class="style43"><cfelseif '#den_class#' eq "3"><span class="style42"><cfelseif
'#den_class#' eq "2" or "1"><span class="style41">
</cfif>#den_class#</span></td>
<td><span class="style34"><cfif '#pha_stat#' eq "R"><span
class="style43"><cfelseif '#pha_stat#' eq "Y"><span class="style42"><cfelseif
'#pha_stat#' eq "g"><span class="style41">
</cfif>#pha_stat#</span></td>
<td><span class="style34"><cfif '#lab_stat#' eq "R"><span
class="style43"><cfelseif '#lab_stat#' eq "Y"><span class="style42"><cfelseif
'#lab_stat#' eq "g"><span class="style41">
</cfif>#lab_stat#</span></td>
<td><span class="style34"><cfif '#dna_stat#' eq "R"><span
class="style43"><cfelseif '#dna_stat#' eq "Y"><span class="style42"><cfelseif
'#dna_stat#' eq "g"><span class="style41">
</cfif>#dna_stat#</span></td>
<td><span class="style34"><cfif '#hiv_stat#' eq "R"><span
class="style43"><cfelseif '#hiv_stat#' eq "Y"><span class="style42"><cfelseif
'#hiv_stat#' eq "g"><span class="style41">
</cfif>#hiv_stat#</span></td>
<td><span class="style34"><cfif '#action_items#' eq "R"><span
class="style43"><cfelseif '#action_items#' eq "Y"><span
class="style42"><cfelseif '#action_items#' eq "g"><span class="style41">
</cfif>#action_items#</span></td>
</tr>
</CFOUTPUT>
Please Help! Thx
coryd218 Guest
-
Query is slowest, why it works always with the index
I have a query that it orders to me for date, and is fastest. Then in an other query I must order for an other field (char (3)) and is slowest,... -
Join Query works in access but not via ColdFusion
I have a query I built with the query builder in Access and through access it works fine. here is the query: SELECT appUsers.AppId,... -
Query works in fine CF5 but not CFMX
I have a simple query against an Oracle database that works in CF 5 but not in CFMX. In CF 5 I get one record which is what I want, but in CFMX I... -
sql-query works alone but not in function...
Hy, My english is not the best, so if you donīt understand something, please ask! I want to print the content of a mysql-table where a field... -
BCP query out executed by xp_cmdshell works fine from query analyzer but fails from VB Component
Hi all, I have a stored procedure which returns a vast number of record and i have to write the output into a csv file. I'm using BCP utility to... -
OldCFer #2
Re: Query Works in ACCESS DB but not on Front End
For one thing you can't use double quotes around cfquery values.
DEN_STAT="R" for example should be DEN_STAT='R' also you should
enclose your AND and OR clauses in brackets so there is no ambiguity. Does
A=1 and B=2 OR C=3 OR D=4 mean
(A=1 and B=2) OR (C=3 OR D=4)
(A=1) and (B=2 OR C=3) OR (D=4)
Results can be different depending on how they are grouped.
OldCFer Guest
-
OldCFer #3
Re: Query Works in ACCESS DB but not on Front End
There's nothing wrong with using "<" . It's a standard comparison operator in
SQL.
There's no other way to say less than. As for your dates, they will always
contain time.
That's normal. The way you set the format , "short date", just affects the way
Access
will display it in Access. Just use the cf
DateFormat(qry.datevalue,"mm/dd/yy") to
display it in your application.
OldCFer Guest



Reply With Quote

