indupriya9
Programmer
I have two files, one which displays questions from an Access database (this is working fine) The problem is with the inserting of results into the databse. the code is as follows : I am getting an Object Required :" error in line 66
<%@ Language=VBScript %>
<%
Option Explicit
Response.buffer=true
Response.write "Hi You have reached the results page"
Dim rs, conn1, NumPerPage, CurrentPage, mySQL, c_id, radiogp
set conn1 = Server.Createobject("ADODB.Connection")
conn1.open "Provider=Microsoft.JET.OLEDB.4.0;Data Source=" & server.mappath("../quiz/profile.mdb")
set rs=Server.CreateObject("ADODB.RecordSet")
set rs = conn1.Execute("select * from questions order by Q_Id")
'response.write rs
'response.end
dim conn,rst, sqltext
dim category,answer,adate,ipaddr,q_id,item
For each item in REquest.Form("q_id")
category = Request.Form("category")
ipaddr = request.serverVariables("REMOTE_ADDR")
adate = Request.Form("Day")
q_id = Request.Form("q_id")
Response.write "The q_id is :" &q_id
dim Maint
Maint = Request.Form ("q_id")
select case Maint
case 1
answer = rs.fields("rating1").value
case 2
answer = rs.fields("rating2").value
case else
answer = rs.fields("rating3").value
end select
response.write "the answer is:" &answer
set conn = Server.CreateObject("ADODB.Connection")
conn.open "Provider=Microsoft.JET.OLEDB.4.0;Data Source=" & server.mappath("../quiz/profile.mdb")
'sqltext = "select * from answers;"
set rst = Server.CreateObject("ADODB.RecordSet")
'rst.Open sqltext, conn
sqltext = ""
sqltext = sqltext & "Insert into answers ([Category_Id],[IPAddr],[Adate],[Answer]) Values ("
sqltext = sqltext & Category & ", '" & request.serverVariables("REMOTE_ADDR") & "', #" & date() & "#, " & answer & ");"
response.write "<br>"
response.write "The category is " & category
response.write "<br>"
response.write "The ipaddress is " & ipaddr
response.write "<br>"
response.write "The Question ID is " & q_id
'response.end
response.write "<br>"
response.write sqltext
conn.execute sqltext
Next
line 66 = conn.close
set conn = Nothing
%>
Please let me know what I am doing wrong.
Thanks
ip
<%@ Language=VBScript %>
<%
Option Explicit
Response.buffer=true
Response.write "Hi You have reached the results page"
Dim rs, conn1, NumPerPage, CurrentPage, mySQL, c_id, radiogp
set conn1 = Server.Createobject("ADODB.Connection")
conn1.open "Provider=Microsoft.JET.OLEDB.4.0;Data Source=" & server.mappath("../quiz/profile.mdb")
set rs=Server.CreateObject("ADODB.RecordSet")
set rs = conn1.Execute("select * from questions order by Q_Id")
'response.write rs
'response.end
dim conn,rst, sqltext
dim category,answer,adate,ipaddr,q_id,item
For each item in REquest.Form("q_id")
category = Request.Form("category")
ipaddr = request.serverVariables("REMOTE_ADDR")
adate = Request.Form("Day")
q_id = Request.Form("q_id")
Response.write "The q_id is :" &q_id
dim Maint
Maint = Request.Form ("q_id")
select case Maint
case 1
answer = rs.fields("rating1").value
case 2
answer = rs.fields("rating2").value
case else
answer = rs.fields("rating3").value
end select
response.write "the answer is:" &answer
set conn = Server.CreateObject("ADODB.Connection")
conn.open "Provider=Microsoft.JET.OLEDB.4.0;Data Source=" & server.mappath("../quiz/profile.mdb")
'sqltext = "select * from answers;"
set rst = Server.CreateObject("ADODB.RecordSet")
'rst.Open sqltext, conn
sqltext = ""
sqltext = sqltext & "Insert into answers ([Category_Id],[IPAddr],[Adate],[Answer]) Values ("
sqltext = sqltext & Category & ", '" & request.serverVariables("REMOTE_ADDR") & "', #" & date() & "#, " & answer & ");"
response.write "<br>"
response.write "The category is " & category
response.write "<br>"
response.write "The ipaddress is " & ipaddr
response.write "<br>"
response.write "The Question ID is " & q_id
'response.end
response.write "<br>"
response.write sqltext
conn.execute sqltext
Next
line 66 = conn.close
set conn = Nothing
%>
Please let me know what I am doing wrong.
Thanks
ip