CodeAve.com CodeAve.com - ASP - Database Table Display
ASP
·Read/Write
·Script Writers
·Database Display
·Response Objects
·Server Variables
·Random Events
·Articles
·Miscellaneous
·Contents
·What's New?
JavaScript
CSS
HTML
Maps
Links
Mail List
Search
Sitemap


 


Date/Time Stamping User Input
Do you have users entering data into an Access db online?  Would you like to know when they entered their input?  Utilizing the default value option in Access you can create a Date/Time field that will automatically enter the date date() or date time now() when you insert values into the table.  The following example will take user inputted text add it to an Access db that has three fields sample_text (whatever the user enters), input_date (set to date(),)and input_datetime (set to now()).  After the input is added to the dc the last ten additions will display.
View the Output
Text View
Print View
Mail this Link
Download the Code
View the Data

<title>CodeAve.com(Date/Time Stamping User Input)</title>
<body bgcolor="#FFFFFF">
<%
u_text=server.htmlencode(request.form("u_text"))

'Check to see if the user has inputted anything
if u_text <> "" then

'Insert the users inputted value only into the Access db
accessdb="datetime" 
cn="driver={Microsoft Access Driver (*.mdb)};"
cn=cn & "dbq=" & server.mappath(accessdb)
set rs = server.createobject("ADODB.Recordset")
sql = "insert into datetime_table (sample_text) "
sql = sql & "values ('" & u_text & "')"
rs.Open sql, cn

'Read the Access db for the last 10 in descending order
rs.maxrecords=10
sql="select * from datetime_table order by input_datetime desc"
rs.Open sql, cn
'Write out the last 10 inputted values to the browser
rs.movefirst
for count = 1 to 10
%>

<b>Number <%= count %> Most Recent</b> <br> 
<b>Inputted Text:</b> <%= rs("sample_text") %> <br>
<b>Date Inputted:</b> <%= rs("input_date") %> <br>
<b>Date/Time Inputted:</b> <%= rs("input_datetime") %> <br>
<b>Day/Date Inputted:</b> <%= formatdatetime(rs("input_datetime"),vblongdate) %> <br>

<br>

<%
rs.movenext
next
'If there is no user inuput or if a blank was entered
'display the input form
else
%>

<form action="<%= request.servervariables("script_name") %>" method="post">
<input type="text" name="u_text" maxlength="25">
<input type="submit" value="Submit">
</form>
<% end if 'end check for user input %>

 

 

 



ASP: What's New? | Articles | Script Writers | Database Display | Read/Write
Server Variables | Response Objects | Random Events | Miscellaneous
HTML: Forms | Hyperlinks | Headers | Tables | Hyperlinks | Headers | Text Display
JavaScript: Document Info | Forms | Images | Navigation | Script Writers
CSS: Basics | Page Display | Text Display | Script Writers | Miscellaneous
  • 2014 michael kors
  • air max women 2013
  • 2014 michael kors
  • air max 2014
  • oakley glasses
  • oakley glasses

  • Maps: Map Script Writers | Bing Maps | Google Maps
  • bottes fr
  • ugg boot
  • Privacy Statement

    CodeAve.com is hosted by MyHosting.com
    Donate Food Online with a Mouse Click at TheHungerSite.com
    Donate Land Online with a Mouse Click at TheRainForestSite.com
    © 1999 - 2017 CodeAve.com
    All Rights Reserved

  • Kids jordan 6 rings
  • Jordan retro 10
  • Jordan retro 3