Skip to main content
Participant
October 12, 2010
Question

Please Help! Too few parameters. Expected 3.

  • October 12, 2010
  • 3 replies
  • 1453 views

So I keep getting an error

Error Executing Database Query.

[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 3.

The error comes from the bolded & italicised line.  I have not changed anything recently in my code, it only started to happen today.  Any suggestions on how to fix it?

And the block of code is:

<cffunction name="getArchives" access="public" returnType="query" output="false" >
  <cfargument name="archiveYears" type="numeric" required="false" default="0">
  <cfset var getMonthlyArchives = "" />
  <cfset var fromYear = year(now()) - arguments.archiveYears />
 
  <cfquery name="getMonthlyArchives" datasource="#instance.dsn#" username="#instance.username#" password="#instance.password#">
   SELECT MONTH(tblBlogEntries.posted) AS PreviousMonths,
          YEAR(tblBlogEntries.posted) AS PreviousYears,
       COUNT(tblBlogEntries.id) AS entryCount
   FROM tblBlogEntries
   WHERE tblBlogEntries.blog = <cfqueryparam value="#instance.name#" cfsqltype="CF_SQL_VARCHAR" maxlength="50">
   <cfif arguments.archiveYears gt 0>
   AND YEAR(tblBlogEntries.posted) >= #fromYear#
   </cfif>
   GROUP BY YEAR(tblBlogEntries.posted), MONTH(tblBlogEntries.posted)
   ORDER BY PreviousYears DESC, PreviousMonths DESC   
  </cfquery>
 
  <cfreturn getMonthlyArchives>
</cffunction>

    This topic has been closed for replies.

    3 replies

    brlahueAuthor
    Participant
    October 12, 2010

    Raymond, I hope you read this, I just solved the problem.  For some reason all of my pods were disabled and were no longer in rank order.  When I renabled them the error went away just like thank.  Could there be a bug in the new release?

    cfjedimaster
    Inspiring
    October 12, 2010

    Not sure - but - I'm glad it is working for you.

    brlahueAuthor
    Participant
    October 12, 2010

    Raymond I can try to get one for you tomorrow, unfortunately only our network admin as access to the CF Admin so I will see if she can get take one for me.

    Do you have any ideas of why it would just suddenly start when absolutely nothing has changed?  Because up until today the blog was working just fine.

    cfjedimaster
    Inspiring
    October 12, 2010

    That looks like BlogCFC, and if so, you cannot use the ODBC Socket

    driver. This should be specified in the directions. Use the MySQL

    driver.

    brlahueAuthor
    Participant
    October 12, 2010

    Raymond, it is BlogCFC. We are using MSACCESS and the said DSN we also have it set to MSACCESS int he BlogCFC.ini.cfm.  But it is still producing the error.

    cfjedimaster
    Inspiring
    October 12, 2010

    Can you share a screen shot of your DSN settings?