473,387 Members | 1,592 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

update stt- Too few parameters. Expected 1.

7
let me tell u what the code deos:
retrieve data ( text box, 2 radio buttons, ) from db.
on selection of any of the radio buttons, the counter should be incremented accordinglt
in the database i have these fields, question, option1,option2,option1_ctr,option2_ctr.
if option1 is clicked, then option1_ctr should be incremented. similarly
if option2 is clicked, then option2_ctr should be incremented.
Expand|Select|Wrap|Line Numbers
  1. <%
  2. Dim Conn         'Holds the Database Connection Object
  3. Dim RS          'Holds the recordset for the records in the database
  4. Dim mySQL         'Holds the SQL query to query the database 
  5. Dim execSQL 
  6. Dim ques
  7. Dim opt1
  8. Dim opt2
  9. Dim y_ctr
  10. Dim n_ctr
  11. Dim theform 
  12.  
  13.  
  14. Set Conn = Server.CreateObject("ADODB.Connection")
  15.  
  16. Conn.ConnectionString = "DSN=pollz"
  17. Conn.Open
  18.  
  19.  
  20. mySQL = "SELECT * FROM pollz"
  21.  
  22.  
  23. Set RS = Server.CreateObject("ADODB.Recordset")
  24. RS.Open mySQL, Conn
  25. rs.movefirst 
  26. clr=1
  27. 'ques=rs("question")
  28. 'session("ques")=ques
  29. yes_ctr=rs("option1_ctr")
  30. no_ctr=rs("option2_ctr")
  31. opt1= rs("option1")
  32. opt2 =rs("option2")
  33. response.write "yes" & yes_ctr
  34. response.write "no" & no_ctr
  35. %>
  36. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  37. <html>
  38. <head>
  39. <SCRIPT language="JavaScript">
  40.  
  41. function testButton (form){
  42. var y_ctr;
  43. var n_ctr;
  44. var quest;
  45. y_ctr = <% =yes_ctr %>
  46. n_ctr = <% =no_ctr %>
  47. alert(y_ctr)
  48. alert(n_ctr)
  49.  
  50.  
  51.        if (form.ans[0].checked)
  52.            {
  53.         alert("inside")
  54.         y_ctr=y_ctr+1;
  55.         document.array1.hid_code_y.value=y_ctr;
  56.          document.array1.hid_code_n.value=n_ctr;
  57.  
  58.         }
  59.        else
  60.        {
  61.        n_ctr=n_ctr+1;
  62.        document.array1.hid_code_n.value=n_ctr;
  63.        document.array1.hid_code_y.value=y_ctr;
  64.            }
  65.  
  66. document.array1.submit();
  67. }
  68. </script>
  69. </head>
  70.  
  71. <body>
  72.  
  73. <form name='array1' method='post' action='post.asp'>
  74.  
  75. <table valign='top' border=1 align=center width='80%' cellpadding=0 cellspacing=0>
  76. <tr><td width='70%'> <%= rs("question") %></td>
  77. <td width='6%'><input type='radio' onClick='testButton(this.form)' name='ans' value= <%=rs("option1") %>> <%=rs("option1") %></td>
  78. <td width='6%'><input type='radio' onClick='testButton(this.form)' name='ans' value= <%=rs("option2") %>> <%=rs("option2") %></td>
  79. </table>
  80. <input type='hidden' name='hid_code_y'>
  81. <input type='hidden' name='hid_code_n'> 
  82. <input type='hidden' name='quess' value= <%= rs("question")%>>
  83. </form>
  84. <%
  85. y_ctr=request.Form("hid_code_y")
  86. n_ctr=request.Form("hid_code_n")
  87. quest=request.Form("quess")
  88. session("ques")=quest
  89. response.write quest
  90.  
  91. ty=rs(1)
  92. response.write ty
  93. execSQL="update pollz set option1_ctr=" & y_ctr & ",option2_ctr=" & n_ctr & " where question=" & ty
  94.  
  95. response.write execSQL
  96. Conn.execute(execSQL)
  97. RS.Close
  98. Set RS = Nothing
  99. Set Conn = Nothing
  100.  
  101. %>
  102.  
  103.  
  104. </body>
  105. </html>
Mar 8 '08 #1
1 1612
jhardman
3,406 Expert 2GB
so... Do you have a question?

Jared
Mar 18 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Dave | last post by:
I have 2 tables, one with names, and another with addresses, joined by their CIVICID number (unique to the ADDRESSINFO table) in Oracle. I need to update a field in the NAMEINFO table for a...
8
by: Lauren Quantrell | last post by:
In VBA, I constructed the following to update all records in tblmyTable with each records in tblmyTableTEMP having the same UniqueID: UPDATE tblMyTable RIGHT JOIN tblMyTableTEMP ON...
17
by: kalamos | last post by:
This statement fails update ded_temp a set a.balance = (select sum(b.ln_amt) from ded_temp b where a.cust_no = b.cust_no and a.ded_type_cd = b.ded_type_cd and a.chk_no = b.chk_no group by...
27
by: VK | last post by:
<http://www.jibbering.com/faq/#FAQ3_2> The parts where update, replacement or add-on is needed are in <update> tag. 3.2 What online resources are available? Javascript FAQ sites, please...
16
by: robert | last post by:
been ruminating on the question (mostly in a 390/v7 context) of whether, and if so when, a row update becomes an insert/delete. i assume that there is a threshold on the number of columns of the...
9
by: jaYPee | last post by:
I have search a lot of thread in google newsgroup and read a lot of articles but still i don't know how to update the dataset that has 3 tables. my 3 tables looks like the 3 tables from...
7
by: jaYPee | last post by:
I am having a problem on how to update view from sql server 2000 database. I have tried dataset and sql dataadapter but no luck. I'm using this view in datagrid and i want to update the datagrid if...
3
by: PAUL | last post by:
Hello, I have 2 datasets I am trying to update. The parent table seems to update fine but when I go update the chiled table I get an error message that says I need a related record in the parent...
5
by: PAUL | last post by:
Hello, I have 2 tables with a relationship set up in the dataset with vb ..net. I add a new record to the parent table then edit an existing child record to have the new parent ID. However when I...
5
by: Stephen Plotnick | last post by:
I'm very new to VB.NET 2003 Here is what I have accomplished: MainSelectForm - Selects an item In a public class I pass a DataViewRow to ItemInformation1 Form ItemInformation2 Form
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.