Query Help

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>
rurth24Asked:
Who is Participating?
 
mrichmonConnect With a Mentor Commented:
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
 
mrichmonCommented:
what isn't working?
0
 
rurth24Author Commented:
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
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
Ryan ChongCommented:
make sure <CFQUERYPARAM cfsqltype="CF_SQL_INTEGER" value="#URL.EmployeesId#"> is Not empty value ??
0
 
rurth24Author Commented:
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
 
rurth24Author Commented:
You were correct..mrichmon. My code was right..
It was a DB error.. one of my fields were misspelled.

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.