Solved

Changing ColdFusion script for SQL queries to queries for ACCESS

Posted on 2007-11-21
2
143 Views
Last Modified: 2013-12-16
Here is an example...

<cfquery name="GetUser" datasource="truckpoetry">
SELECT      *
FROM       Users
WHERE      UserName       = '#Form.UserName#'
AND       Password       = '#Form.Password#'
</cfquery>

I badly need a simple ColdFusion page that allows user to login using information (Username and password) provided during registration with a basic correct or wrong reply. All tutorials seem to be for SQL.

Can someone help me understand how to make them suit an ACCESS database.

Thanks
0
Comment
Question by:Ryan Bayne
2 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 250 total points
ID: 20332369
That query works perfectly against an Access database.   Note, the attached is _not_  a good way to do a login.  It's an example meant to demonstrate the query does work 'as is' with Access.


<cfif IsDefined("form.submitButton")>

	<cfquery name="checkUser" datasource="truckpoetry">

		SELECT  *

		FROM	Users

		WHERE   UserName       = '#Form.UserName#'

		AND     Password       = '#Form.Password#'

	</cfquery>

	<cfif checkUser.recordCount GT 0>

		<div style="color: #008000;">

			Success.  Username and password validated!

		</div>

	<cfelse>	

		<div style="color: #ff0000;">

			Error. Invalid username or password entered

		</div>

	</cfif>

</cfif>
 

<!--- change thisPage.cfm to name of your test page ---> 

<form action="thisPage.cfm" method="post">

	UserName <input type="text" name="userName"><br>

	Password <input type="password" name="password"><br>

	<input type="submit" name="submitButton">

</form>

Open in new window

0
 
LVL 2

Author Comment

by:Ryan Bayne
ID: 20333114
Excellent!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

In this short web based tutorial, I wanted to show users how they can still use the powers of FrontPage in conjunction with Expression Web 3.  Even though Microsoft eliminated the use of Web components, we can still use them with FrontPage and edit …
Turn A Profile Picture Into A Cartoon Using Photoshop And Illustrator This tutorial will teach you how to make a cartoon style image out of a regular picture. I have tried to keep the tutorial as simple as possible. I used Adobe CS4 for this tuto…
The purpose of this video is to demonstrate how to automatically show related posts at the bottom of a blog post in WordPress. This will be demonstrated using a Windows 8 PC. Plugin “Yet Another Related Posts Plugin” will be used. Go to your…
The purpose of this video is to demonstrate how to properly insert a Vimeo Video into a WordPress site or Blog. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp…

895 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now