View Full Version : Need some help with some ASP code I am using...

Clarkey Boy
04-15-2006, 07:09 PM

I have only been learning ASP for several days now and am hoping to become a professional web designer.

I used the following code for my page - it does not come up with any errors and I used basically the same code for another page (which does work), but this page does not work as it will not submit comments from the form into the database. I would be very grateful for any help anyone could give me.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

Dim adoCon
Dim rscomments
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open ("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=d:\websites/clarkeyboy/datasource/comments.mdb")
Set rscomments = Server.CreateObject("ADODB.Recordset")
SQL = "SELECT comments FROM comments"
rscomments.CursorType = 2
rscomments.LockType = 3
rscomments.Open SQL, adoCon
Comments: (Place your comments here and press enter)
<input type="text" rows="20" cols="150" name="comment">
<table align="center" border="3" width="100%">
<td width="10%">
Comment Number
<td width="90%">
Dim x
x = 0
Do While not rscomments.EOF
<td width="50%">
x = x + 1
<td width="50%">
Response.Write (rscomments("comments"))
Dim strcomment
strcomment = Request.Form("comment")
Dim strNothing
strNothing = ""
If strcomment = strNothing Then
Response.Write("Please submit a comment")
rscomments("comments") = strComment
Response.Write("Thank you for submitting a comment")
End If

Displaying the information from the database works fine - so the connection is definitely there - but I can't get it to create new records.

I have a database called comments, a table called comments and the column being taken from the table is also called comments - not necessarily a very good combination to call them all comments but its easy to handle at this stage.

Clarkey Boy
04-15-2006, 07:28 PM
ok... Solved it - never put the method in for the form as I didn't know quite how important it was. What EXACTLY does the "post" method actually do? And how do you use the "get" method?

04-18-2006, 03:51 PM
Post submits data.
You retrieve it using Request.Form("var")

Get grabs data using the querystring

id = Request.QueryString("id")
user = Request.QueryString("user")


EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum