G
Guest
Hi;
I trying to get information from a simple MS Access database named users
which consists of a single table called user_info with three fields
(username, password and stylesheet). Username and password are string fields
and stylesheet is a simple integer. I've created a Javascript form called
user_form with two fields: username and password. The form also has two
buttons; reset and submit.
When clicked, the submit button will ensure that both form fields are not
empty or null then create a sql select statement to locate the info in the
database. The database select statement is as follows:
SQLstr = "SELECT [stylesheet] FROM users WHERE
(([username] = document.user_form.username.value) AND
([password] = document.user_form.password.value))";
The fields in square brackets are the database fields. What I'm trying to do
is get the stylesheet number (name of the stylesheet like 2.css ) of the
appropriate record and pass it to a webpage so that the webpage will obey the
statements in the stylesheet. The other fields i.e.
document.user_form.username.value are the field values from the form.
Are the square bracket fields correct or should they be something like
users.user_info. username, etc. ?
The database connection I'm using and where the SQLstr will be used is:
// connection string construction
var strConn = "Driver={Microsoft Access Driver
(*.mdb)};DBQ=" + Server.MapPath("user.mdb");
// connection object creation
var dbConn = Server.CreateObject("ADODB.Connection");
// open the connection
dbConn.Open(strConn);
// Execute the query with constructed SQLstr
var rs = dbConn.Execute(SQLstr);
Any help is greatly appreciated.
I trying to get information from a simple MS Access database named users
which consists of a single table called user_info with three fields
(username, password and stylesheet). Username and password are string fields
and stylesheet is a simple integer. I've created a Javascript form called
user_form with two fields: username and password. The form also has two
buttons; reset and submit.
When clicked, the submit button will ensure that both form fields are not
empty or null then create a sql select statement to locate the info in the
database. The database select statement is as follows:
SQLstr = "SELECT [stylesheet] FROM users WHERE
(([username] = document.user_form.username.value) AND
([password] = document.user_form.password.value))";
The fields in square brackets are the database fields. What I'm trying to do
is get the stylesheet number (name of the stylesheet like 2.css ) of the
appropriate record and pass it to a webpage so that the webpage will obey the
statements in the stylesheet. The other fields i.e.
document.user_form.username.value are the field values from the form.
Are the square bracket fields correct or should they be something like
users.user_info. username, etc. ?
The database connection I'm using and where the SQLstr will be used is:
// connection string construction
var strConn = "Driver={Microsoft Access Driver
(*.mdb)};DBQ=" + Server.MapPath("user.mdb");
// connection object creation
var dbConn = Server.CreateObject("ADODB.Connection");
// open the connection
dbConn.Open(strConn);
// Execute the query with constructed SQLstr
var rs = dbConn.Execute(SQLstr);
Any help is greatly appreciated.