
March 3rd, 2000, 04:35 AM
|
|
Contributing User
|
|
Join Date: Dec 2002
Posts: 14,575
  
Time spent in forums: < 1 sec
Reputation Power: 24
|
|
|
I need help!
<i><b>Originally posted by : alex santos (pope81@hotmail.com)</b></i><br />I'm very new to asp, can somebody help me with this code. what the code is actually doing is to save data entered in the form to the database. the problen is I don't know how to structure the code or I don't know how to run the script, please give me direction on what I should do to make this code run properly.<br /><br /> by the way I joined www.ewebcity.com it is a free asp webhosting and Im doing my asp pages with them.<br /><br /><br />Heres the code<br /><br /><html><head><br /><title>Adding Data to The Database</title><br /><br /><%@ Language = "VBScript"%><br /><%<br /><br />sub SaveRecord()<br /><br />dim conn<br />dim rs<br />dim strID<br />dim strconn<br /><br />Set Conn = Server.CreateObject("ADODB.Connection")<br />Conn.Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("haidsdb est.mdb"))<br /><br />set rs = server.createobject("adodb.recordset")<br />rs.open "tblAdoAdd", conn, 2, 2<br />rs.addnew<br /><br />rs("FirstName") = request("FirstName") <br />rs("LastName") = request("LastName")<br />rs("MiddleName") = request("MiddleName") <br />rs.update<br /><br />set rs= nothing<br />set conn = nothing<br /><br />end sub<br />%><br /></head><br /><br /><body><br /><h3 align="center">Adding Data to The Database</h3><br /><td width="424"><form method="post" name="sample.asp" action="test.asp"><br /><p><strong>First Name</strong><br><br /><input type="text" size="40" name="FirstName"><br><br /><strong>Last Name</strong><br><br /><input type="text" size="40" name="LastName"><br><br /><strong>Middle Name</strong><br><br /><input type="text" size="40" name="MiddleName"><br><br /><p><input Language="vbscript" type="Button" value="Submit" name"b1" ONCLICK="SaveRecord()"> </font></p><br /></form><br /></td><br /></tr><br /></table><br /></center></div><br /></body></html><br /><br />
|