Unable to connect to access database, I m not able to connect Access database by asp |
Unable to connect to access database, I m not able to connect Access database by asp |
bhagyesh |
Feb 17 2011, 03:03 PM
Post
#1
|
Group: Members Posts: 2 Joined: 17-February 11 Member No.: 13,907 |
Hi, Urgent Help required.
I m new to html, i have created html form and asp file to connect form input to database. I have gathered all these stuff from internet over wide research. I have IIS installed on my PC. But when ever i click on submit button of form it promt me to save asp file again and again. and i have also tried this on other PC but some times it just directs me to another browser tab and shows asp coding in it. I have rechecked my both html and asp coding again and again but unable to find sol. HTML CODING: <html> <body> <form name="form" method="post" action="save.asp"> Name: <input type="text" name="name" maxlength="45"> <br> Comments: <textarea cols="20" rows="8" name="comments" maxlength="200"> </textarea><br> <input type="submit" name="Save" value="Submit" onClick="return validate();"> </form> </body> </html> ASP coding: <% Dim Conn Dim Rs Dim sql 'Create an ADO connection and recordset object Set Conn = Server.CreateObject("ADODB.Connection") Set Rs = Server.CreateObject("ADODB.Recordset") 'Set an active connection and select fields from the database Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("FeedBack.mdb") sql= "SELECT name, comments FROM tblFeeds;" 'Set the lock and cursor type Rs.CursorType = 2 Rs.LockType = 3 Rs.Open sql, Conn 'Open the recordset with sql query Rs.AddNew 'Prepare the database to add a new record and add Rs.Fields("name") = Request.Form("name") Rs.Fields("comments") = Request.Form("comments") Rs.Update 'Save the update Rs.Close Set Rs = Nothing Set Conn = Nothing %> Beside that there was also mentioned as an asp coding for displaying data entered into html form, i don't have any idea how to view inserted data. So please tell me how to (procedure) view data using this asp file.. I have got below coding from internet: <% Dim Conn Dim Rs Dim sql Set Conn = Server.CreateObject("ADODB.Connection") Set Rs = Server.CreateObject("ADODB.Recordset") Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("FeedBack.mdb") sql= "SELECT name, comments FROM tblFeeds;" Rs.Open sql, Conn Do While not Rs.EOF Response.Write ("============================================="&"<br>") Response.Write ("Name: " & "<font color='red'>" & Rs("name") & "</font>") Response.Write ("<br>") Response.Write ("Comment: " & "<font color='red'>" & Rs("comments") & "</font>") Response.Write ("<br>") Rs.MoveNext Loop Rs.Close Set Rs = Nothing Set Conn = Nothing %> sorry for my bad english |
Lo-Fi Version | Time is now: 26th April 2024 - 02:32 PM |