|
|
||||||
|
||||||
| Index Link To US Private Messages Archive FAQ RSS | ||||||
| Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome. |
Share Thread: & Tags
|
||||
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hello experts,
I'm struggling with my asp code and have some questions relating to asp and oracle database. First question. I have a web survey that I am working on and have successfully dynamically taken the info from a database, displayed it on the screen and then taken the users answers and inserted them into a database table. Let me explain the problem now that you have the background with my code. Code:
<table width="60%" cellspacing="0" cellpadding="5">
<%
Do while not objRS.eof
response.write (objRS("Question_Id")& ". ")&(objRS("Descr")& "
") & "
"
Do while not objTxt.eof
%>
<% If (objTxt("Type")) = "Radio" then %>
<input type="checkbox" name="questions" value="<%=objTxt("sub_text")%>"> <%=(objTxt("Text")&"
")%>
<input type="hidden" name="HiddenSurveyID" value="<%=objRS("Survey_ID")%>">
<input type="hidden" name="HiddenQuestionID" value="<%=objRS("Question_id")%>">
<input type="hidden" name="HiddenText" value="<%=objTxt("text")%>">
<%ELSE%>
<%=(objTxt("Text"))%><input type="text" size ="75" name="textBoxAnswer"
value="">
<%End IF%>
<%
objTxt.movenext()
Loop
objRS.movenext()%>
<%
Loop
%>
</table>
How are you today good(checkbox field) Not bad(checkbox field) excellent(checkbox field) Other(Text box field) The subquestions have values of a,b,c,d in the database. When the user chooses good for instance I want the value a to be written to the database and in another column in the database the value good. Instead it is writing A and then "good,not bad and excellent". It is looping but have no idea how to just take the value that they selected. If the whole structure of the loop needs to be changed please change it to whatever you experts think is needed. Secondly, how do I take the value of the text input field if other is chosen for the associated question and then add d(or whatever value it is) and the users text value. So in the above example, if the user chooses other and writes in the text box(horrible day, got into an accident), I want to insert into the database d and "horrible day, got into an accident". Here is the code that passes those values Code:
<%
oConn.Open
Set oCmd = Server.CreateObject("ADODB.Command")
oCmd.ActiveConnection = oConn
oCmd.CommandType = 4
oCmd.CommandText = "surveyanswerinsert.surveyanswerinsert"
oCmd.Parameters.Append oCmd.CreateParameter("SurveyID", adVarChar, adParamInput, 400, Request.Form("HiddenSurveyID"))
oCmd.Parameters.Append oCmd.CreateParameter("AnswerID", adVarChar, adParamInput, 900, Request.Form("questions"))
oCmd.Parameters.Append oCmd.CreateParameter("Text", adVarChar, adParamInput, 900, Request.Form("HiddenText"))
oCmd.Execute
%>
Code:
Error Type: ADODB.Command (0x800A0D5D) Application uses a value of the wrong type for the current operation. Thanks experts and sorry for all the questions. |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
WebProWorld |
Advertise |
Contact Us |
About |
Forum Rules |
MVP's |
Archive |
Newsletter Archive |
Top |
WebProNews
WebProWorld is an iEntry, Inc. ® site - © 2009 All Rights Reserved Privacy Policy and Legal iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509 |