By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,812 Members | 856 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,812 IT Pros & Developers. It's quick & easy.

modify multipale rows in database

idsanjeev
100+
P: 241
hello
i want to modify multiple rows in database with select option i am using R.update but it can update only one record in database but i wants to more then one record is modify after submit so what code i have to use i am using
Expand|Select|Wrap|Line Numbers
  1. <% 
  2.   If Not IsEmpty(Request.Form("submit")) then
  3.   vopenflg = Request.Form("vopenflg")
  4.   vopenflg=trim(vopenflg)
  5.   conn.close
  6.   conn.Mode = adModeReadWrite
  7.   conn.open
  8.   R1.open "Select open_flg from topmaster ", conn, adOpenStatic, adLockOptimistic, adCmdText
  9.   R1("open_flg")= vopenflg
  10.   R1.update
  11.   R1.Close
  12.   end if
  13. %>
Nov 2 '07 #1
Share this Question
Share on Google+
20 Replies


jhardman
Expert 2.5K+
P: 3,405
Put your update statement within a loop. Youcan loop through various rows of your recordset using the r1.movenext method, then modify that row as desired. Let me know if this helps.

Jared

PS. Your code belongs in code tags like this: [code=asp]'code goes here[/code]
Nov 2 '07 #2

idsanjeev
100+
P: 241
hello,
Jared
when i am using this code it is not report any error or nither update any row
so where is the problems
Expand|Select|Wrap|Line Numbers
  1. 'code goes here
  2. <%   conn.close
  3.   If Not IsEmpty(Request.Form("submit")) then
  4.   vopenflg = Request.Form("vopenflg")
  5.   vopenflg=trim(vopenflg)
  6.   conn.Mode = adModeReadWrite
  7.   conn.open
  8.   R1.open "Select open_flg from topmaster ", conn, adOpenStatic, adLockOptimistic, adCmdText
  9.  while R1.eof
  10.   R1("open_flg")= vopenflg
  11.   R1.update
  12.   R1.movenext
  13.   R1.Close
  14.   wend    
  15.   end if
  16. %>
Nov 3 '07 #3

idsanjeev
100+
P: 241
hello,
Jared
when i am using this code it is not report any error or nither update any row
so where is the problems
another code is
Expand|Select|Wrap|Line Numbers
  1.  'code goes here
  2. <%  do until not  R1.eof
  3.   R1("open_flg")= vopenflg
  4.   R1.update
  5.   R1.movenext
  6.   loop
  7.   R1.Close
  8.   end if
  9.  
and by using the code do whiel not R1.eof instead of do until not R1.eof
error is multiple oledb
so what is
Nov 3 '07 #4

jhardman
Expert 2.5K+
P: 3,405
code should be "do until R1.eof...loop" or "while not R1.eof... wend" or some variation of this.

Jared
Nov 3 '07 #5

idsanjeev
100+
P: 241
hello plz help in updation of data with multiple row. this code is my last modified code which is using today interchange the code but i found some error this code isn't generate any error but modification or updation is not done . os plz see again here
Expand|Select|Wrap|Line Numbers
  1.  R1.open "Select open_flg from topmaster ", conn, adOpenStatic, adLockOptimistic, adCmdText
  2.      Do While Not R1.EOF
  3.      vopenflg=R1("open_flg")
  4.      R1.update
  5.        R1.MoveNext
  6.        loop
  7.      R1.Close
Nov 5 '07 #6

idsanjeev
100+
P: 241
i am using this code then it update all records from table i am using pagingnation and show one record on page plz help in updae to selected rows only thaks
Expand|Select|Wrap|Line Numbers
  1.  <%conn.close
  2.   If Not IsEmpty(Request.Form("submit")) then
  3.   vopenflg = Request.Form("vopenflg")
  4.   vopenflg=trim(vopenflg)
  5.   conn.Mode = adModeReadWrite
  6.   conn.open
  7.   R1.open "Select open_flg from topmaster ", conn, adOpenStatic, adLockOptimistic, adCmdText
  8.   R1("open_flg")=vopenflg
  9.   do while not R1.eof
  10.   R1.moveNext
  11.   loop
  12.   R1.update
  13.   R1.Close
  14.   conn.close
  15.   end if
  16. %>
Nov 6 '07 #7

jhardman
Expert 2.5K+
P: 3,405
idsanjeev,

Since I am bilingual, I understand the difficulty you face in trying to express yourself in a foreign language. Please understand that you have not given enough information for me to answer the question fully. There are many possible ways in which someone may try to "update a database", and your question does not specify what you mean.

I assume that your user will see a table of data which approximates your database. He performs some action like clicking on a button or toggling a checkbox to indicate which records need to be modified. It looks from your question that the user sees a long list of records and next to each one there is a checkbox. He toggles the boxes he would like to update, then clicks a "submit" button. Am I right so far?

Please explain how the form is set up. This is important for me to find the best way to modify the database. If it is difficult for you to explain, please send the code for the form. When you post the code all of the code should be between the two code tags like this:

[code]

<%
dim rs1, query
query = "SELECT topOpenFlg FROM table1 WHERE recordID = "
query = query & request.form("recordID")
set rs1 = server.createobject("ADODB.Recordset")
rs1.open query, conn, 2,3

rs1("topOpenFlg") = date()
rs1.update
%>

[/code]

Jared
Nov 7 '07 #8

idsanjeev
100+
P: 241
hi jhardman
thanks to reply
my deadline of project is very close if i cant submit till tomorw then this project is transferd to other. so please reply soon .
again explained my question what is my target.
i wants to show some records on page from table that can see all and modify any records i wants to modiy then a select list inside all records i.e no,yes,close ,
if i wants to modify any records from display rows then select option from rows inside called apply and click on submit and change only selected rows detail .
but i am in trouble by using this code i able to change all records from table also i am using pagignation to avoide error multiple oledb .
so my question is to help me to modify thats record i wants to modify that is on page so how can modify only thats which i wants.this is my full code plz check my code

Expand|Select|Wrap|Line Numbers
  1.  code is here
  2.  
  3. <%@language=vbscript%>
  4. <%option explicit%>
  5. <%
  6. If Request.Cookies("userid") = "" Then
  7.   Response.Redirect "login.asp"
  8. Else
  9. dim my_conn_stRing, conn,R,R1,R2, sql,Rcount,Rpage,page,i,vopenflg
  10. dim stroutput,reply,repcount,stropt,vtopid
  11. MY_CONN_STRING = "dsn=oracle;uid=starter;pwd=starter;" 
  12. Set Conn = server.createobject("ADODB.Connection")
  13. Conn.open MY_CONN_STRING
  14. set R = Server.CreateObject("ADODB.Recordset")
  15. set R1 = Server.CreateObject("ADODB.Recordset")
  16. set R2 = Server.CreateObject("ADODB.Recordset")
  17. R.open "Select top_id,top_sub,launch_by,launch_dt from topmaster ",conn, adOpenStatic, adLockOptimistic, adCmdText
  18. R.PageSize=1
  19. Repcount=R.RecordCount
  20. Rcount=R.RecordCount 
  21. Rpage=R.PageCount
  22. if Request.QueryString("Reply")="" then
  23. Reply=1 
  24. else
  25.  Reply=cint((Request.QueryString("Reply")))
  26.  end if
  27. if Request.querystring("page")="" then 
  28.   page=1
  29. else
  30.   page=cint((Request.querystring("page")))
  31. end if
  32. %>
  33. <html>
  34. <head><TITLE>Vioce Of Baraunians</TITLE></head>
  35. <body bgcolor="#FFFFFF" background="../SANJEEV/backphoto.gif">
  36. <form name="moderator" action="moderator.asp" method="post">
  37. <!--#include file="front.inc"--><br><br>&nbsp;
  38. <meta http-equiv="Content-Type" content="text/html; charet=iso-8859-1">
  39. <div style="position:absolute; top:100; left:0 ">
  40. <table width="1000" border="0" cellspacing="1" cellpadding="3" bgcolor="#663333" >
  41. <tr bgcolor="#CCCCFF"> 
  42.   <td width="8%" ><b>TOPIC ID</b></td>
  43.   <td bgcolor="#CCCCFF" colspan="100%">&nbsp;&nbsp; <img src="files categories.gif">&nbsp;&nbsp; &nbsp;<b>TOPIC SUBJECT</b></td>
  44.   <td bgcolor="#CCCCFF" width="12%"><img src="group user.gif">&nbsp;&nbsp;<b>POSTED BY</b></td>
  45.   <td bgcolor="#CCCCFF" width="12%"><b>POSTED DATE</b></td>
  46.   <td bgcolor="#CCCCFF"><b>Permission</b></td>
  47.   </tr>
  48.  <%
  49. if not R.eof then
  50. R.Move (page-1)*R.pagesize
  51. end if
  52. if not R.eof then
  53.   for i=1 to R.pagesize
  54.   %> 
  55.   <tr bgcolor="#FFFFFF"> 
  56.     <td bgcolor="#66FF99" width="8%"><%=R("top_id")%></td>
  57.     <td align="left" colspan="100%" bgcolor="#66FF99"><b><font face="arial" size=2><a href=voice.asp?opt=<%=R("top_id")%>><%Response.Write R("top_sub")%></a></font></b></td>
  58.     <td bgcolor="#66FF99" width="12%"><%=R("launch_by")%></td>
  59.     <td bgcolor="#66FF99" width="12%"><%=R("launch_dt")%></td>
  60.          <td width="10%"><font face="arial" size="2"><b>Apply</b></font>
  61.          <select name="vopenflg">
  62.         <%If IsEmpty(vopenflg) or vopenflg = 0 Then%>
  63.           <option value="0" selected>No</option>
  64.           <option value="1">Yes</option>
  65.           <option value="2">clsoe</option>
  66.          <%Elseif vopenflg =1 Then%>
  67.           <option value="0">No</option>
  68.           <option value="1" selected>Yes</option>
  69.           <option value="2">Close</option>
  70.          <%Elseif vopenflg =2 Then%>
  71.           <option value="0">No</option>
  72.           <option value="1">Yes</option>
  73.           <option value="2" selected>Close</option>          
  74.           <%End If%>
  75.       </select>
  76.   </tr>
  77.   <%
  78.   if request.QueryString("opt") then
  79.   stropt=opt
  80.   end if
  81.   if request.QueryString("opt1") then
  82. detail=request.QueryString("opt")
  83. end if
  84.  R.movenext
  85.  If R.EOF Then 
  86.  Exit For 
  87.  end if
  88.  next
  89. end if%> 
  90. </table> 
  91. <table width="1000" border="0" cellspacing="1" cellpadding="3" >
  92. <tr align="right" bgcolor="#99FFFF"> 
  93.   <td><b>Voice of Baraunians views</b></td><td><%Response.write(Application("visitors"))%></td>
  94.   <td> <%If page>1 Then %> <a href="moderator.asp?page=<%=page-1%>">Previous</a> 
  95.     <%end if %> 
  96.     <% If page < rpage Then %> <a href="moderator.asp?page=<%=page+1%>">Next</a> 
  97.     <% end if %> 
  98.     <%if rpage>1 then
  99.           for i=1 to Rpage
  100.               Response.write "<a href=""moderator.asp?page="&i&""">"&i&"</a> "
  101.           next
  102.     end if%> </td>
  103.    </tr>
  104.   </table><br>&nbsp;&nbsp;
  105.  
  106.  <% 
  107.   If Not IsEmpty(Request.Form("submit")) then
  108.    vopenflg = Request.Form("vopenflg")
  109.     vopenflg=trim(vopenflg)
  110.      conn.close
  111.     conn.Mode = adModeReadWrite
  112.    conn.open
  113.   R1.Open "select open_flg from topmaster  ", conn, adOpenStatic, adLockOptimistic, adCmdText
  114.   do while not R1.eof 
  115.   R1("open_flg")=vopenflg
  116.   R1.update
  117.   R1.movenext
  118.   loop
  119.   R1.Close
  120.   conn.close
  121. end if
  122. end if
  123. %>
  124.   <table width=765>
  125.   <tr><td width="60%"></td>
  126.     <td><input type= "submit" name="submit" value="Apply" onclick="update()">
  127.    <input type="button" name="submit" value="Back" onclick="brvoice()">
  128.      <input type ="button" value="EXIT" onClick="window.close()"></td>
  129.   </tr>
  130. </table>
  131. <script language="Javascript">
  132. function brvoice()
  133. {
  134.   window.location = "brvoice.asp"
  135. }
  136.  
  137. function update()
  138. {
  139.   window.location = "moderator.asp"
  140. }
  141.  
  142. </script>
  143. </div>
  144. </form>
  145.  </body>
  146. </html>
  147.  
Nov 7 '07 #9

idsanjeev
100+
P: 241
hi jhardman
is not clear my question .i wants to show records on page that have one column for select list to modify. i wants select option from list and modify after apply button is pressed but only those row that is selected is possible if not then give me other idea to find records and update after modify so plz understand from both posting and answer to my question.thanks
Nov 7 '07 #10

jhardman
Expert 2.5K+
P: 3,405
hi jhardman
is not clear my question .i wants to show records on page that have one column for select list to modify. i wants select option from list and modify after apply button is pressed but only those row that is selected is possible if not then give me other idea to find records and update after modify so plz understand from both posting and answer to my question.thanks
I think I understand what you are asking. Your form is set up very poorly for what you are attempting and you will need to change it. The biggest problem is that each of the select boxes has the same name. There is no way for the script which handles the form to distinguish between the different select boxes or decide which corresponds to which record in the database. In fact if you were to write this:
Expand|Select|Wrap|Line Numbers
  1.  response.write request("vopenflg") 
it would print out
Expand|Select|Wrap|Line Numbers
  1. yes,yes,no,close,yes,no,no,no,close,yes
or something similar. You will either need to split up this info into an array or give each of the select boxes a different name. I would suggest you give each a different name and in this way you can also indicate which select box corresponds to which row in the database. You understand that each record in a database has a unique field called a "key" or "identifier" right? I usually call my key field "ID" or something similar, so I will guess that yours is called "top_id". Is this right? If so, you may name each select box like this:
Expand|Select|Wrap|Line Numbers
  1. <select name="vopenflg<%=R("top_id")%>">
this will give each of the select boxes a unique name like this: "vopenflg135", "vopenflg146", etc. Do you understand? Not only do they each have different names, the name indicates to which record it corresponds.
Nov 8 '07 #11

jhardman
Expert 2.5K+
P: 3,405
On the part of the script which handles the form, you can use the name of the select box to indicate which record needs to be updated. simply loop through the database the same way you did the first time, and update like this:
Expand|Select|Wrap|Line Numbers
  1. if request("vopenflg" & R1("top_id")) <> "" then
  2.    R1("open_flg")=vopenflg
  3.    R1.update
  4. end if
Nov 8 '07 #12

idsanjeev
100+
P: 241
hi jhardman
this is not help i think something wrong but what is i don't Understand.so plzcan you give me code how to modify form which is need if one or more then on rows are disply but modify only selected rows.
Nov 8 '07 #13

jhardman
Expert 2.5K+
P: 3,405
hi jhardman
this is not help i think something wrong but what is i don't Understand.so plzcan you give me code how to modify form which is need if one or more then on rows are disply but modify only selected rows.
No, as I said before, the code depends too much on your set up and your site specifications. I have tried to explain the general idea, but the actual code will need to be custom-made, and that is your job. If you want me to make it for you, I would expect to be paid for it.

Jared
Nov 8 '07 #14

idsanjeev
100+
P: 241
hi jhardman by using this code no any updation and error so plz where is the problems.thanks
Expand|Select|Wrap|Line Numbers
  1.  
  2.         <select name="vopenflg <%=R("top_id")%>">
  3.         <%If IsEmpty(vopenflg) or vopenflg = 0 Then%>
  4.           <option value=" " selected>Normal</option>
  5.            <option value="0">Abuse</option>
  6.           <option value="1">clsoe</option>
  7.          <%Elseif vopenflg =1 Then%>
  8.           <option value=" " >Normal</option>
  9.           <option value="0" selected>Abuse</option>
  10.           <option value="1">clsoe</option>
  11.           <%Elseif vopenflg =2 Then%>
  12.           <option value=" " >Normal</option>
  13.           <option value="0" >Abuse</option>
  14.           <option value="1" selected>clsoe</option>
  15.           <%End If%>
  16.       </select>
  17.   <% R.close
  18.   If Not IsEmpty(Request.Form("submit")) then
  19.    vopenflg = Request.Form("vopenflg")
  20.     vopenflg=trim(vopenflg)
  21.      conn.close
  22.     conn.Mode = adModeReadWrite
  23.    conn.open
  24.    R.open "select top_id,open_flg from topmaster ",conn, adOpenStatic, adLockOptimistic, adCmdText
  25.    if request.QueryString("vopenflg"& R("top_id"))<>"" then
  26.    R("open_flg")=vopenflg
  27.    R.update
  28.    R.Close
  29.   conn.close
  30. end if
  31. end if
  32. end if
  33. %>
  34.  
Nov 10 '07 #15

idsanjeev
100+
P: 241
hi i am change my logic like this link with another page top_id and topicsubject on click topic subject its detail is display on next page called update1.asp i wants to upadta the displyed details column open_flg status plz this is my code for display and update this is display link wise detail but not update so help in updation
Expand|Select|Wrap|Line Numbers
  1. <%@language=vbscript%>
  2. <%option explicit%>
  3. <%
  4. If Request.Cookies("userid") = "" Then
  5.   Response.Redirect "login.asp"
  6. Else
  7. dim my_conn_stRing, conn,R,R1,R2, sql,Rcount,Rpage,page,i,vopenflg
  8. dim stroutput,reply,repcount,stropt1,vtopid
  9. MY_CONN_STRING = "dsn=oracle;uid=starter;pwd=starter;" 
  10. Set Conn = server.createobject("ADODB.Connection")
  11. conn.mode=admodereadwrite
  12. Conn.open MY_CONN_STRING
  13. set R = Server.CreateObject("ADODB.Recordset")
  14. for each stropt1 in request.QueryString
  15. vtopid=request.QueryString(stropt1)
  16. R.open "Select top_id,top_sub,MSG,open_flg,launch_by,launch_dt from topmaster where top_id="&vtopid&" order by top_id desc ",conn, adOpenStatic, adLockOptimistic, adCmdText
  17. %>
  18. <html>
  19. <head><TITLE>Vioce Of Baraunians</TITLE></head>
  20. <body bgcolor="#FFFFFF" background="back.gif">
  21. <form name="update" action="update1.asp" method="post">
  22. <!--#include file="front.inc"--><br><br>&nbsp;
  23. <meta http-equiv="Content-Type" content="text/html; charet=iso-8859-1">
  24. <div style="position:absolute; top:100; left:0 ">
  25. <table width="1000" border="0" cellspacing="1" cellpadding="3" bgcolor="#663333" >
  26. <tr bgcolor="#CCCCFF"> 
  27.   <td width="8%" ><b>TOPIC ID</b></td>
  28.   <td bgcolor="#CCCCFF" colspan="50%">&nbsp;&nbsp; <b>TOPIC SUBJECT</b></td>
  29.   <td bgcolor="#CCCCFF" colspan="50%"><b>MESSAGE</b></td>
  30.   <td bgcolor="#CCCCFF" width="12%">&nbsp;&nbsp;<b>POSTED BY</b></td>
  31.   <td bgcolor="#CCCCFF" width="12%"><b>POSTED DATE</b></td>
  32.   <td bgcolor="#CCCCFF"><b>Permission</b></td>
  33.   </tr>
  34.   <tr bgcolor="#FFFFFF"> 
  35.     <td bgcolor="#66FF99" width="8%"><%=R("top_id")%></td>
  36.     <td align="left" colspan="50%" bgcolor="#66FF99"><b><font face="arial" size=2><%Response.Write R("top_sub")%></font></b></td>
  37.     <td bgcolor="#66FF99" COLSPAN="50%"><%=R("msg")%></td>
  38.     <td bgcolor="#66FF99" width="12%"><%=R("launch_by")%></td>
  39.     <td bgcolor="#66FF99" width="12%"><%=R("launch_dt")%></td>
  40.     <td width="10%"><font face="arial" size="2"><b>Apply</b></font>
  41.          <select name="vopenflg">
  42.           <option value=" " >Normal</option>
  43.           <option value="0" >Abuse</option>
  44.           <option value="1">clsoe</option>
  45.       </select>
  46.   </tr>
  47. </table> 
  48. <table width="1000" border="0" cellspacing="1" cellpadding="3" >
  49. <tr align="right" bgcolor="#99FFFF"> 
  50.   <td><b>Voice of Baraunians views</b></td><td><%Response.write(Application("visitors"))%></td>
  51.    </tr>
  52.   </table><br>&nbsp;&nbsp;
  53.  
  54.  <% 
  55.   If Not IsEmpty(Request.Form("submit")) then
  56.    vopenflg = Request.Form("vopenflg")
  57.     vopenflg=trim(vopenflg)
  58.    R("open_flg")=vopenflg
  59.    R.update
  60.    R.Close
  61.    conn.close
  62. end if
  63. next
  64. end if
  65. %>
  66.   <table width=765>
  67.   <tr><td width="60%"></td>
  68.     <td><input type= "submit" name="submit" value="Apply">
  69.    <input type="button" name="submit" value="Back" onclick="moderate()">
  70.      <input type ="button" value="EXIT" onClick="window.close()"></td>
  71.   </tr>
  72. </table>
  73. <script language="Javascript">
  74. function moderate()
  75. {
  76.   window.location = "moderator1.asp"
  77. }
  78. </script>
  79. </div>
  80. </form>
  81.  </body>
  82. </html>
  83.  
Nov 12 '07 #16

idsanjeev
100+
P: 241
hi i am creating a link with topid and display row detail after click i wants to update open_flg value which is selected and store in vopenflg but it is not change so any body help me it update only normal thats value is null cahracter
Expand|Select|Wrap|Line Numbers
  1. <%@language=vbscript%>
  2. <%option explicit%>
  3. <%
  4. If Request.Cookies("userid") = "" Then
  5.   Response.Redirect "login.asp"
  6. Else
  7. dim my_conn_stRing, conn,R,R1,R2, sql,Rcount,Rpage,page,i,vopenflg
  8. dim stroutput,reply,repcount,stropt1,vtopid,detail
  9. MY_CONN_STRING = "dsn=oracle;uid=starter;pwd=starter;" 
  10. Set Conn = server.createobject("ADODB.Connection")
  11. Conn.open MY_CONN_STRING
  12. set R = Server.CreateObject("ADODB.Recordset")
  13. for each stropt1 in request.QueryString
  14. vtopid = request.QueryString(stropt1)
  15. R.open "Select top_id,top_sub,MSG,open_flg,launch_by,launch_dt from topmaster where top_id="&vtopid&"",conn, adOpenStatic, adLockOptimistic, adCmdText
  16. %>
  17. <html>
  18. <head><TITLE>Vioce Of Baraunians</TITLE></head>
  19. <body bgcolor="#FFFFFF" background="back.jpg">
  20. <!--#include file="front.inc"--><br><br>&nbsp;
  21. <meta http-equiv="Content-Type" content="text/html; charet=iso-8859-1">
  22. <div style="position:absolute; top:100; left:0 ">
  23. <table width="1000" border="0" cellspacing="1" cellpadding="3" bgcolor="#663333" >
  24. <tr bgcolor="#CCCCFF"> 
  25.   <td width="8%" ><b>TOPIC ID</b></td>
  26.   <td bgcolor="#CCCCFF" colspan="50%">&nbsp;&nbsp; <b>TOPIC SUBJECT</b></td>
  27.   <td bgcolor="#CCCCFF" colspan="50%"><b>MESSAGE</b></td>
  28.   <td bgcolor="#CCCCFF" width="12%">&nbsp;&nbsp;<b>POSTED BY</b></td>
  29.   <td bgcolor="#CCCCFF" width="12%"><b>POSTED DATE</b></td>
  30.   <td bgcolor="#CCCCFF"><b>Permission</b></td>
  31.   </tr>
  32.   <tr bgcolor="#FFFFFF"> 
  33.     <td bgcolor="#66FF99" width="8%"><%=R("top_id")%></td>
  34.     <td align="left" colspan="50%" bgcolor="#66FF99"><b><font face="arial" size=2><%Response.Write R("top_sub")%></font></b></td>
  35.     <td bgcolor="#66FF99" COLSPAN="50%"><%=R("msg")%></td>
  36.     <td bgcolor="#66FF99" width="12%"><%=R("launch_by")%></td>
  37.     <td bgcolor="#66FF99" width="12%"><%=R("launch_dt")%></td>
  38.     <form action="update1.asp" method="post">
  39.       <% 
  40.       vopenflg=request.Form("vopenflg")
  41.       dim sqlstr
  42.       sqlstr = "update topmaster set open_flg = '"&trim(Request.Form("vopenflg"))&"' where top_id = " & vtopid 
  43.       response.Write(vopenflg)
  44.       conn.execute sqlstr
  45.       R.close
  46.      response.redirect("moderator1.asp")
  47.       conn.close
  48.       set conn=nothing
  49.       end if
  50.      next
  51. %><form action="update1.asp" method="post">
  52.     <td width="10%"><font face="arial" size="2"><b>Apply</b></font>
  53.          <select name="vopenflg">
  54.         <%If IsEmpty(vopenflg) Then%>
  55.         <option value=" ">Normal</option>
  56.           <option value="0">Absue</option>
  57.           <option value="1">clsoe</option>
  58.           <%End If%>
  59.       </select>
  60.   </tr>
  61.   <tr><td>topic id <%response.Write(vtopid)%></td></tr>
  62. </table> 
  63. <table width="1000" border="0" cellspacing="1" cellpadding="3" >
  64. <tr align="right" bgcolor="#99FFFF"> 
  65.   <td><b>Active user</b></td><td><%Response.write(Application("visitors"))%></td>
  66.    </tr>
  67.   </table><br>&nbsp;&nbsp;
  68.  
  69.   <table width=765>
  70.   <tr><td width="60%"></td>
  71.     <td><input type= "submit" value="submit">
  72.    <input type="button" name="submit" value="Back" onclick="moderate()">
  73.      <input type ="button" value="EXIT" onClick="window.close()"></td>
  74.   </tr><tr><td>hello<%response.Write(vopenflg)%></td></tr>
  75. </table>
  76. <%end if%>
  77. <script language="Javascript">
  78. function moderate()
  79. {
  80.   window.location = "moderator1.asp"
  81. }
  82. </script>
  83. </form>
  84. </div>
  85.  </body>
  86. </html>
  87.  
Nov 13 '07 #17

idsanjeev
100+
P: 241
mistake in line

Expand|Select|Wrap|Line Numbers
  1. <%
  2. if request.Form("submit") then
  3. %>
  4.  
Nov 13 '07 #18

jhardman
Expert 2.5K+
P: 3,405
I merged threads for you. Please do not double-post questions.
Nov 18 '07 #19

jhardman
Expert 2.5K+
P: 3,405
Do you have a link to this? Maybe I would understand it better if I could see it.

Also, is this all on one page, or do you have the form and form handler on separate pages?

Jared
Nov 19 '07 #20

idsanjeev
100+
P: 241
Hi jhardman
thanks to reply and understand my question .i got my result the value is losed before updating so the problems is solved. Thanks again becouse project is not completed without help so all guies is help me in completion of my project. i am submitted it today.I am taking more time in small project but one thing is know my bassic is not clear so i try to clear it .thanks to all.
Nov 20 '07 #21

Post your reply

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