?
Solved

Query Help

Posted on 2005-04-07
6
Medium Priority
?
166 Views
Last Modified: 2013-12-24
Can't seem to get the hang of this.... Practice makes perfect....right?
Okay so I'm working with 2 DB's:
CLIENTS - This holds all my client info: ( CLIENTID, COMPANYN, EMPLOYEESID )
TIMESHEETS - This db tbl holds all timesheet info( TIMESHEETID (primary key), EMPLOYEESID, CLIENTID, DDATE, HSPENT )

I just want to display a listing in a HTML Table...


<CFQUERY name="listhours"
     datasource="#Request.MainDSN#">
SELECT *
FROM
      Timesheets
LEFT JOIN
      Clients
ON
      Clients.ClientID = Timesheets.ClientID
WHERE
      Timesheets.EmployeesID = <CFQUERYPARAM cfsqltype="CF_SQL_INTEGER" value="#URL.EmployeesId#">
ORDER BY ddate ASC
</CFQUERY>

<TABLE BORDER="0" CELLPADDING="3" CELLSPACING="3" CLASS="mainTxtBd">
              <CFOUTPUT QUERY="listhours">
      <TR>
                <TD>#CompanyN#</TD>
                <TD>#HSPENT#</TD>
                <TD>#dateformat(ddate,"mm/dd/yyyy")#</TD>
              </TR>
      </CFOUTPUT>
            </TABLE>
0
Comment
Question by:rurth24
  • 3
  • 2
6 Comments
 
LVL 35

Expert Comment

by:mrichmon
ID: 13729705
what isn't working?
0
 

Author Comment

by:rurth24
ID: 13729723
I'm getting an error. What should I be looking for when I get the TOO FEW PARAMETERS. EXPECTED 2?

Error Executing Database Query.  
[MERANT][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2.  
 
EmployeeTimeSheet.cfm: line 66
 
64 :     <TD width=246 height=39><A HREF="../index.html"><IMG HEIGHT=39 SRC="images/top04.gif" WIDTH=246 BORDER=0></A></TD>
65 :     <TD vAlign=top align=left width=629 height=39><IMG height=39 SRC="images/corner_structure.gif" width=143></TD>
66 :     <TD WIDTH="285" HEIGHT="39" align=right class=mainTxtBd><CFOUTPUT>#session.firstname# Is Currently Logged In<BR>
67 :         <A HREF="client.cfm" CLASS="error">HOME</A> |&nbsp;<A href="logout.cfm" CLASS="error">LOGOUT</A> | <A HREF="employeeedit.cfm?ProfileID=1" CLASS="error">MY PROFILE</A> </CFOUTPUT></TD>
68 :   </TR>

 
0
 
LVL 54

Expert Comment

by:Ryan Chong
ID: 13730436
make sure <CFQUERYPARAM cfsqltype="CF_SQL_INTEGER" value="#URL.EmployeesId#"> is Not empty value ??
0
Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

 

Author Comment

by:rurth24
ID: 13730454
This is where it's coming from so I think that part is working..

<CFFORM ACTION="EmployeeTimeSheet.cfm?employeesID=#session.EmployeesID#" METHOD="get">
                  <TD ALIGN="CENTER">
                    <INPUT TYPE="submit" NAME="TimeSheet" VALUE="view">
</TD>
                </CFFORM>
0
 
LVL 35

Accepted Solution

by:
mrichmon earned 500 total points
ID: 13730751
It usually means one of a couple things:

1) There are not enough fields being sent in that are required in the database
2) There is a syntax error in the query.

That error is really strange if those a re the lines of code it pointed you to.  They can't possible be causeing the error.

Although one mistake I see is that cfforms are method="post"   You don't have to say so they just are.  So I would remove the method="get" or you need to use a regular html form.


You need to be focussing your attention on any lines taht are :
cfinsert
cfupdate
cfquery

as that is a access interface error.
0
 

Author Comment

by:rurth24
ID: 13730884
You were correct..mrichmon. My code was right..
It was a DB error.. one of my fields were misspelled.

0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question