CodeAve.com CodeAve.com - ASP - Read/Write
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


 


Simple Database Input and Display
Inputting data into an Access or SQL server database is a piece of cake in .asp. This script will take input for two text fields (First and Last name) and write them to an Access db. A second script will allow you to view all of the inputs into the Access to date.
View the Output
Text View
Print View
Mail this Link
Download the Code
View the Data

input_text_to_db_form.asp
<font face = "arial" size="1">
<form method="post" action="input_text_to_db.asp">
<input type="hidden" name="subject" value="<%= title %>">
First Name<br>
<input type="text" name="u_fname" size="20"><br>
Last Name<br>
<input type="text" name="u_lname" size="20">
<input type="submit" value="Submit">
</form></font>

input_text_to_db.asp
<%
 u_lname=request.form("u_lname")
u_fname=request.form("u_fname")
%>

<%
accessdb="testinputdb" 
cn="DRIVER={Microsoft Access Driver (*.mdb)};"
cn=cn & "DBQ=" & server.mappath(accessdb)
set rs = server.createobject("ADODB.Recordset")

SQL = "insert into testtable (lname, fname) "

SQL = SQL & "values ('" & u_lname 
SQL = SQL & "','" & u_fname & "')"

rs.Open sql, cn
%>

<font face = "arial" size="1">
First Name <%= u_fname %>
<br>
Last Name <%= u_lname %>
<br>
has been added to the db <br>
<a href = "input_text_db_view.asp">View the Table</a>
</font>

input_text_to_db_view.asp
<%
accessdb="testinputdb" 
cn="DRIVER={Microsoft Access Driver (*.mdb)};"
cn=cn & "DBQ=" & server.mappath(accessdb)
Set rs = Server.CreateObject("ADODB.Recordset")

sql = "select * from testtable" 

rs.Open sql, cn
%>

<div align="left">

<table BORDER="0" BGCOLOR="#FFFFFF" CELLSPACING="0" align="left" width="640">
<THEAD>

<tr>
<th valign="top" align="left"><font face="Arial" size="2" color="#000000">First Name</font></th>
<th valign="top" align="left"><font face="Arial" size="2" color="#000000">Last Name</font></th>
<th valign="top" align="left"><font face="Arial" size="2" color="#000000">Unique ID</font></th>
</tr>
</THEAD>
<TBODY>

<%
On Error Resume Next
rs.MoveFirst
do while Not rs.eof
%>


<tr VALIGN="TOP">
<td ALIGN="left" valign="top">
<font face="Arial" size="2" color="#000000">
<%= rs("fname") %>
</font></td>

<td ALIGN="left" valign="top">
<font face="Arial" size="2" color="#000000">
<%= rs("lname") %>
</font></td>

<td ALIGN="left" valign="top">
<font face="Arial" size="2" color="#000000">
<%= rs("unique_id") %>
</font></td>

</tr>

<%
rs.MoveNext
loop%>


<tr VALIGN="TOP">
<td ALIGN="left" valign="top">
&nbsp;</td>

<td ALIGN="left" valign="top">
&nbsp;</td>

<td ALIGN="left" valign="top">
&nbsp;</td>

</tr>

</TBODY>
<TFOOT>
</TFOOT>
</table>
</div>

 

 

 



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