'adding data in database of ms access using asp forms
'steps : 1. create adatabase in ms access and save it as .mdb in wwwroot directory
'step2. create aform in notepad and save it as .html code is given at the bottom of tha page
'step3 : write the code for asp page in notepad and save it as .asp in wwwroot directory
'some common errors observed : do not provde the path in this format like (C:\inetpub\wwwroot) in form 'page
'secondly provide 2 (for openkeyset) and 2( for pessismistic lock )
'if your page displays cannot update or delete then #include adovbs.inc
'run and enjoy....
<html>
<head><title>Displaying records</title>
<% Dim objcon,strcon
Set objcon=Server.CreateObject("ADODB.Connection")
strcon="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Inetpub\wwwroot\company.mdb"
objcon.open strcon
dim objrs
set objrs=Server.CreateObject("ADODB.RecordSet")
objrs.open "item_info",objcon,2,2
objrs.addnew
objrs("itemcode")=request.form("itemcode")
objrs("itemname")=request.form("itemname")
objrs("itemqty")=request.form("itemqty")
objrs.update
%>
</head>
<body>
<H2>Student Table</H2>
<TABLE border=1>
<% While NOT objrs.eof %>
<TR>
<TD> <%= objrs("itemcode") %></TD>
<TD> <%= objrs("itemname") %></TD>
<TD> <%= objrs("itemqty") %></TD></tr>
<%
objrs.MoveNext%>
<%Wend%><%
objrs.close
objcon.close
set objcon=nothing
Set objrs=Nothing
%></table>
</body>
</html>
entry.html*create separate notead file
<html>
<head>
<form method ="post" action ="addrec.asp">
itemcode<input type="text" name="itemcode"></br>
itemname<input type="text" name="itemname"></br>
itemqty <input type="text" name="itemqty"></br>
<input type="submit" name="submit" value="submit"></br>
</form>
</body>
</html>
'steps : 1. create adatabase in ms access and save it as .mdb in wwwroot directory
'step2. create aform in notepad and save it as .html code is given at the bottom of tha page
'step3 : write the code for asp page in notepad and save it as .asp in wwwroot directory
'some common errors observed : do not provde the path in this format like (C:\inetpub\wwwroot) in form 'page
'secondly provide 2 (for openkeyset) and 2( for pessismistic lock )
'if your page displays cannot update or delete then #include adovbs.inc
'run and enjoy....
<html>
<head><title>Displaying records</title>
<% Dim objcon,strcon
Set objcon=Server.CreateObject("ADODB.Connection")
strcon="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Inetpub\wwwroot\company.mdb"
objcon.open strcon
dim objrs
set objrs=Server.CreateObject("ADODB.RecordSet")
objrs.open "item_info",objcon,2,2
objrs.addnew
objrs("itemcode")=request.form("itemcode")
objrs("itemname")=request.form("itemname")
objrs("itemqty")=request.form("itemqty")
objrs.update
%>
</head>
<body>
<H2>Student Table</H2>
<TABLE border=1>
<% While NOT objrs.eof %>
<TR>
<TD> <%= objrs("itemcode") %></TD>
<TD> <%= objrs("itemname") %></TD>
<TD> <%= objrs("itemqty") %></TD></tr>
<%
objrs.MoveNext%>
<%Wend%><%
objrs.close
objcon.close
set objcon=nothing
Set objrs=Nothing
%></table>
</body>
</html>
entry.html*create separate notead file
<html>
<head>
<form method ="post" action ="addrec.asp">
itemcode<input type="text" name="itemcode"></br>
itemname<input type="text" name="itemname"></br>
itemqty <input type="text" name="itemqty"></br>
<input type="submit" name="submit" value="submit"></br>
</form>
</body>
</html>