iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
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

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-05-2006, 01:54 PM
WebProWorld New Member
 
Join Date: Jun 2006
Posts: 2
MrhelpMe RepRank 0
Default Need help ASAP with ASP and oracle code

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>
This is the code that loops through each question from the database and then displays the question and associated choices underneath. ie.
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 
%>
Lastly, as you can see with the above code you might be wondering why I used adVarchar for SurveyID and AnswerID. Well I don't want to but if I make the surveyID adNumeric and change the survey id field in the database to Number and run this code on the web I get
Code:
Error Type:
ADODB.Command (0x800A0D5D)
Application uses a value of the wrong type for the current operation.
It only works with adVarchar. Could someone tell me what I am doing wrong. It's oracle 9 and classic asp.

Thanks experts and sorry for all the questions.
Reply With Quote
  #2 (permalink)  
Old 06-06-2006, 11:48 AM
WebProWorld New Member
 
Join Date: Jun 2006
Posts: 2
MrhelpMe RepRank 0
Default Sorry guys in need ASAP for the answer

Hello experts,

Does anyone have an answer for this please.
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 06:24 AM.



Search Engine Optimization by vBSEO 3.3.0