Whenever I see this error message in database queries to an MS Access DB, and 
it appears that everything is correct with the query, it is most likely due to 
using reserved words or functions in Microsoft's implementation of SQL. If you 
don't want to make changes to the database, then surround every instance of a 
column name and table name with square brackets like so. Also, use cfqueryparam 
on all queries where user supplied input is used for query parameters.

SELECT *
FROM [Users]
WHERE     [UserLogin] = <cfqueryparam value="#Form.UserLogin#" 
cfsqltype="cf_sql_varchar"/>
     AND [Password] = <cfqueryparam value="#Form.Password#" 
cfsqltype="cf_sql_varchar"/>



ENTERED AN EARLIER POST ON THIS SAME QUERY PROBLEM. ORIGINALLY IT WAS A
 SYNTAX PROBLEM. HOWEVER, NOW I AM GETTING THE FOLLOWING ERROR. THIS IS
 A SIMPLE LOGIN APPLICATION.

Error Executing Database Query.
[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC
 Microsoft Access Driver] Too few parameters. Expected 1.
 
The error occurred in
 C:\Inetpub\wwwroot\RickRossiter\NLR\Templates\loginCheck.cfm: line 19
Called from
 C:\Inetpub\wwwroot\RickRossiter\NLR\Templates\loginForm.cfm: line 206
Called from
 C:\Inetpub\wwwroot\RickRossiter\NLR\PrivateAccess\Application.cfm: line 17
Called from
 C:\Inetpub\wwwroot\RickRossiter\NLR\Templates\loginCheck.cfm: line 19
Called from
 C:\Inetpub\wwwroot\RickRossiter\NLR\Templates\loginForm.cfm: line 206
Called from
 C:\Inetpub\wwwroot\RickRossiter\NLR\PrivateAccess\Application.cfm: line 17

17 :     SELECT *
18 :     FROM Users
19 :     WHERE UserLogin = '#Form.UserLogin#' AND Password =
 '#Form.Password#'
20 : </cfquery>
21 : 

SQL        SELECT * FROM Users WHERE UserLogin = 'paulw' AND Password =
 'PPMILL'
DATASOURCE       RickRossiter
VENDORERRORCODE       -3010
SQLSTATE       07002
Resources:

    * 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/5.0 (Windows; U; Windows NT 5.1; en-US;
 rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11


CODE SOURCE:

PROCESS BEGINS IN (application.cfm) WHEN USER ENTERS SECTION OF SITE
 REQUIRING A LOGIN:

(application.cfm)

<!---If user is not logged in force them to log in--->

 <cfif NOT isDefined("SESSION.Auth.IsLoggedIn")>
 
     <!---If the user is now submitting login action via login form--->
    <!---Include "Login Check" code to validate the user attempting to
 log in.--->
    
    <cfinclude template="../Templates/loginForm.cfm">
    <cfabort>
 </cfif>

NEXT THE USER IS PROMPTED TO THE LOGIN PAGE: 

<cfif isDefined("form.UserLogin")>
    <cfinclude template="loginCheck.cfm">
</cfif>


<span class="Header">Enter Access Code</span>
<br>
<cfform action="../PrivateAccess/showAR.cfm" Name="LoginForm"
 method="post">
<input type="hidden" name="UserLogin_required">
<input type="hidden" name="Password_required">
    <!---userLogin Field is required--->
    User Name: 
    <cfinput 
        type="text" 
        name="UserLogin" 
        size="20" 
        value="" 
        maxlength="24" 
        required="yes" 
        message="Please enter your user name. Thank you."
        style="height:14px; width:125px; font-size:12px;
 font-weight:bold; color: maroon; letter-spacing:0.2em; text-align:left;">
    <p>&nbsp;</p><p>&nbsp;</p>
    Password:     
    <cfinput 
        type="password" 
        name="Password" 
        size="24" value="" 
        maxlength="24" 
        required="yes" 
        message="Please enter your assigned password to access this
 part of the site. Thank you."
        style="height:14px; width:125px; font-size:12px;
 font-weight:bold; color: maroon; letter-spacing:0.2em; text-align:left">

<cfinput type="submit" name="Enter">

</cfform>

WHICH IS CHECKED BY THE FOLLOWING CODE:

<!---The following code queries the database to find the record of the
 user's password.--->
<cfparam name="Form.UserLogin" type="string">
<cfparam name="Form.Password" type="string">


<cfquery name="getUser" datasource="#dsn#">
    SELECT *
    FROM Users
    WHERE UserLogin = '#Form.UserLogin#' AND Password =
 '#Form.Password#'
</cfquery>



<!---
    If the user's password is correct the following code verifies 
    it and obtains the information then creates a distinct session for
 each user
    that logs in.
--->

<cfif getUser.RecordCount EQ 1>
    <cflocation url="../PrivateAccess/showAR.cfm">

    <!---
        The following code remembers the user's "logged-in" status
        their user type and their first name in the session structure.
    --->
    <cfset SESSION.Auth = StructNew()>
    <cfset SESSION.Auth.IsLoggedIn = "yes">
    <cfset SESSION.Auth.userID = getUser.userID>
    <cfset SESSION.Auth.FirstName = getUser.FirstName>
    
    <!---
        Now that user is logged in, the following code sends them to
        PrivateAccess/showAR.cfm page and menu links.
    --->
    <cflocation url="#CGI.SCRIPT_NAME#">
</cfif>

AS YOU CAN SEE THE QUERY "IS" PULLING THE DATA FROM THE DATABASE, BUT
 THROWING THIS ERROR MESSAGE. I TURNED ON DEBUGGING BUT THIS DID NOT
 REVEAL ANYTHING MORE THAN THE ORIGINAL ERROR MESSAGE. USING DREAMWEAVER 8
 AND CFMX SERVERS. IF ANYONE CAN EXPLAIN THIS I SURE WOULD APPRECIATE IT.

NICK
[EMAIL PROTECTED]






~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:297214
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to