The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Unable to connect to access database, I m not able to connect Access database by asp
bhagyesh
post 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
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Feb 17 2011, 03:14 PM
Post #2


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,716
Joined: 9-August 06
Member No.: 6



Are you sure ASP is available on your server?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
bhagyesh
post Feb 17 2011, 04:17 PM
Post #3





Group: Members
Posts: 2
Joined: 17-February 11
Member No.: 13,907



QUOTE(pandy @ Feb 17 2011, 03:14 PM) *

Are you sure ASP is available on your server?



Ok.... i have installed IIS, i m tring this on my PC which is in workgroup.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 28th March 2024 - 07:30 PM