Active Server Page logo View ASP Source


<html>
<head>
<title>Add DataBase</title>
</head>
<body>

<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open(Server.mappath("database.mdb"))
set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "select * from tblGuestBook", conn
%>


<h2>Adding Records</h2>
<form method="post" action="demo_db_new.asp">
<table>
<%
for each x in rs.Fields
      if x.name <> "no" and x.name <> "dateadded" then%>

      <tr>
      <td><%=x.name%></td>
      <td><input name="<%=x.name%>" value="N/A"></td>
      <%
      end if
next
rs.close
conn.close
%>

</tr></table>
<p><input type="submit" name="action" value="Add Record"> </p>
</form>

<p><a href="showcode.asp?source=demo_db_add.asp">View source code on how to
create input fields based on the fields in the database table</a>.</p>
<p><b>Note:</b> If you click on "Add Record" you will be taken to a
new page. On that page you will be able to look at the source code on how to add
a new record to a database table.</p>
<p><a href="ado_demo.asp">Return to previous page</a></p>
</body>
</html>