Forms, ASP & DBs

M

Mike Mueller

I am using a Form to collect login information to validate
users with an ASP page against a database. What I would
like to add to this is to write the username & time into
another table (we'll call it history). My ASP page is using
ADO to connect to the DB if that helps. What I need to know
is how to setup the SQL statement to put these values in.
The other item I need to know is how to get the time into a
field for this.

Mike
 
C

Carmen

Hey Mike:

The SQL statement for inserting a value into a table is:
"INSERT INTO TableName (TableFieldName1, TableFieldName2)
VALUES ("ActualValue", "ActualValue")

Substitute TableName for your table's name.
Substitute TableFieldName1 for the field name you are
interested in.
Substitute ActualValue for the real value you are
inserting into TableFieldName1 and 2.
If you are inserting variables into the field,
then "ActualValue" should be '"& VariableName &"'

You can also find a tutorial for this at
http://sqlcourse.com/insert.html

As for time, create a field for this in your database.
Then in your SQL statement above refer to your table
field and the corresponding value will be Now(), like
this:
"INSERT INTO TableName (Timestamp) VALUES (Now())"
 
M

MD WebsUnlimited.com

Hi Mike,

If it is in a different table then you'll need to use two insert statements
to accomplish.

There is no need to include the time unless of course you wish to capture
the visitors time and not the servers. Instead make the database field
default to the current date and time (server)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top