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 -
<%
-
If Not IsEmpty(Request.Form("submit")) then
-
vopenflg = Request.Form("vopenflg")
-
vopenflg=trim(vopenflg)
-
conn.close
-
conn.Mode = adModeReadWrite
-
conn.open
-
R1.open "Select open_flg from topmaster ", conn, adOpenStatic, adLockOptimistic, adCmdText
-
R1("open_flg")= vopenflg
-
R1.update
-
R1.Close
-
end if
-
%>
20 2339 jhardman 3,406
Recognized Expert Specialist
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]
hello,
Jared
when i am using this code it is not report any error or nither update any row
so where is the problems - 'code goes here
-
<% conn.close
-
If Not IsEmpty(Request.Form("submit")) then
-
vopenflg = Request.Form("vopenflg")
-
vopenflg=trim(vopenflg)
-
conn.Mode = adModeReadWrite
-
conn.open
-
R1.open "Select open_flg from topmaster ", conn, adOpenStatic, adLockOptimistic, adCmdText
-
while R1.eof
-
R1("open_flg")= vopenflg
-
R1.update
-
R1.movenext
-
R1.Close
-
wend
-
end if
-
%>
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 - 'code goes here
-
<% do until not R1.eof
-
R1("open_flg")= vopenflg
-
R1.update
-
R1.movenext
-
loop
-
R1.Close
-
end if
-
and by using the code do whiel not R1.eof instead of do until not R1.eof
error is multiple oledb
so what is
jhardman 3,406
Recognized Expert Specialist
code should be "do until R1.eof...loop" or "while not R1.eof... wend" or some variation of this.
Jared
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 -
R1.open "Select open_flg from topmaster ", conn, adOpenStatic, adLockOptimistic, adCmdText
-
Do While Not R1.EOF
-
vopenflg=R1("open_flg")
-
R1.update
-
R1.MoveNext
-
loop
-
R1.Close
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 -
<%conn.close
-
If Not IsEmpty(Request.Form("submit")) then
-
vopenflg = Request.Form("vopenflg")
-
vopenflg=trim(vopenflg)
-
conn.Mode = adModeReadWrite
-
conn.open
-
R1.open "Select open_flg from topmaster ", conn, adOpenStatic, adLockOptimistic, adCmdText
-
R1("open_flg")=vopenflg
-
do while not R1.eof
-
R1.moveNext
-
loop
-
R1.update
-
R1.Close
-
conn.close
-
end if
-
%>
jhardman 3,406
Recognized Expert Specialist
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("r ecordID")
set rs1 = server.createob ject("ADODB.Rec ordset")
rs1.open query, conn, 2,3
rs1("topOpenFlg ") = date()
rs1.update
%>
[/code]
Jared
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 - code is here
-
-
<%@language=vbscript%>
-
<%option explicit%>
-
<%
-
If Request.Cookies("userid") = "" Then
-
Response.Redirect "login.asp"
-
Else
-
dim my_conn_stRing, conn,R,R1,R2, sql,Rcount,Rpage,page,i,vopenflg
-
dim stroutput,reply,repcount,stropt,vtopid
-
MY_CONN_STRING = "dsn=oracle;uid=starter;pwd=starter;"
-
Set Conn = server.createobject("ADODB.Connection")
-
Conn.open MY_CONN_STRING
-
set R = Server.CreateObject("ADODB.Recordset")
-
set R1 = Server.CreateObject("ADODB.Recordset")
-
set R2 = Server.CreateObject("ADODB.Recordset")
-
R.open "Select top_id,top_sub,launch_by,launch_dt from topmaster ",conn, adOpenStatic, adLockOptimistic, adCmdText
-
R.PageSize=1
-
Repcount=R.RecordCount
-
Rcount=R.RecordCount
-
Rpage=R.PageCount
-
if Request.QueryString("Reply")="" then
-
Reply=1
-
else
-
Reply=cint((Request.QueryString("Reply")))
-
end if
-
if Request.querystring("page")="" then
-
page=1
-
else
-
page=cint((Request.querystring("page")))
-
end if
-
%>
-
<html>
-
<head><TITLE>Vioce Of Baraunians</TITLE></head>
-
<body bgcolor="#FFFFFF" background="../SANJEEV/backphoto.gif">
-
<form name="moderator" action="moderator.asp" method="post">
-
<!--#include file="front.inc"--><br><br>
-
<meta http-equiv="Content-Type" content="text/html; charet=iso-8859-1">
-
<div style="position:absolute; top:100; left:0 ">
-
<table width="1000" border="0" cellspacing="1" cellpadding="3" bgcolor="#663333" >
-
<tr bgcolor="#CCCCFF">
-
<td width="8%" ><b>TOPIC ID</b></td>
-
<td bgcolor="#CCCCFF" colspan="100%"> <img src="files categories.gif"> <b>TOPIC SUBJECT</b></td>
-
<td bgcolor="#CCCCFF" width="12%"><img src="group user.gif"> <b>POSTED BY</b></td>
-
<td bgcolor="#CCCCFF" width="12%"><b>POSTED DATE</b></td>
-
<td bgcolor="#CCCCFF"><b>Permission</b></td>
-
</tr>
-
<%
-
if not R.eof then
-
R.Move (page-1)*R.pagesize
-
end if
-
if not R.eof then
-
for i=1 to R.pagesize
-
%>
-
<tr bgcolor="#FFFFFF">
-
<td bgcolor="#66FF99" width="8%"><%=R("top_id")%></td>
-
<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>
-
<td bgcolor="#66FF99" width="12%"><%=R("launch_by")%></td>
-
<td bgcolor="#66FF99" width="12%"><%=R("launch_dt")%></td>
-
<td width="10%"><font face="arial" size="2"><b>Apply</b></font>
-
<select name="vopenflg">
-
<%If IsEmpty(vopenflg) or vopenflg = 0 Then%>
-
<option value="0" selected>No</option>
-
<option value="1">Yes</option>
-
<option value="2">clsoe</option>
-
<%Elseif vopenflg =1 Then%>
-
<option value="0">No</option>
-
<option value="1" selected>Yes</option>
-
<option value="2">Close</option>
-
<%Elseif vopenflg =2 Then%>
-
<option value="0">No</option>
-
<option value="1">Yes</option>
-
<option value="2" selected>Close</option>
-
<%End If%>
-
</select>
-
</tr>
-
<%
-
if request.QueryString("opt") then
-
stropt=opt
-
end if
-
if request.QueryString("opt1") then
-
detail=request.QueryString("opt")
-
end if
-
R.movenext
-
If R.EOF Then
-
Exit For
-
end if
-
next
-
end if%>
-
</table>
-
<table width="1000" border="0" cellspacing="1" cellpadding="3" >
-
<tr align="right" bgcolor="#99FFFF">
-
<td><b>Voice of Baraunians views</b></td><td><%Response.write(Application("visitors"))%></td>
-
<td> <%If page>1 Then %> <a href="moderator.asp?page=<%=page-1%>">Previous</a>
-
<%end if %>
-
<% If page < rpage Then %> <a href="moderator.asp?page=<%=page+1%>">Next</a>
-
<% end if %>
-
<%if rpage>1 then
-
for i=1 to Rpage
-
Response.write "<a href=""moderator.asp?page="&i&""">"&i&"</a> "
-
next
-
end if%> </td>
-
</tr>
-
</table><br>
-
-
<%
-
If Not IsEmpty(Request.Form("submit")) then
-
vopenflg = Request.Form("vopenflg")
-
vopenflg=trim(vopenflg)
-
conn.close
-
conn.Mode = adModeReadWrite
-
conn.open
-
R1.Open "select open_flg from topmaster ", conn, adOpenStatic, adLockOptimistic, adCmdText
-
do while not R1.eof
-
R1("open_flg")=vopenflg
-
R1.update
-
R1.movenext
-
loop
-
R1.Close
-
conn.close
-
end if
-
end if
-
%>
-
<table width=765>
-
<tr><td width="60%"></td>
-
<td><input type= "submit" name="submit" value="Apply" onclick="update()">
-
<input type="button" name="submit" value="Back" onclick="brvoice()">
-
<input type ="button" value="EXIT" onClick="window.close()"></td>
-
</tr>
-
</table>
-
<script language="Javascript">
-
function brvoice()
-
{
-
window.location = "brvoice.asp"
-
}
-
-
function update()
-
{
-
window.location = "moderator.asp"
-
}
-
-
</script>
-
</div>
-
</form>
-
</body>
-
</html>
-
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
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Fan Ruo Xin |
last post by:
I try to copy a table from production system (DB2 UDB EEE V7.2 + fixpak5)
to the testing system (DB2 UDB V8.1 + fixpak4a).
I moved the data from productions system by using the following steps:
On production system:
$ db2 "export to xxxxx.del of del select * from xxxxxx"
On testing system:
I use db2 utility autoload, because I use the autoload cfg script for a long
|
by: MikeY |
last post by:
Hi everyone,
I have posted earlier this week, but I'm still scratching my head trying to
figure out how to change/modify my data back to my db.
Using C# Windows forms. I am trying to learn how to modify existing data
with in my DB/MSDE. In general, I have textbox's filled with existing data
from my "Employee" table. I have amongst other buttons, an "Update" button.
Where, when viewing, if I want to change ie the persons name, anyother...
|
by: Henry |
last post by:
Hi. I've been trying to modify my dataset and have been unsucessful. Any
help would be great.
What I have is a dataset in a session variable. Here is what I have done to
stored into the dataset via store procedure.
Sample Stored Procedure:
CREATE PROCEDURE prcGetData
AS
|
by: VitorJOL |
last post by:
Hello
I have a listbox with a datasource.I want to remove a row from listbox but
not remove it from the database.
How can i do this ?
PROBLEM:"Cannot modify the Items collection when the DataSource property is
set."
|
by: muttu2244 |
last post by:
Hi everybody
Am trying to read a csv file "temp.csv", which has the below info,
compName macAddr ipAddr
opSys
| |
by: mimasci |
last post by:
Hi,
I have tried to write a code that allowed me to modify the value of
the cells selected in a table, with excel has been easy.
How one approaches selected cells? (To modify the value)
How can I translate the code, in MS-Excel, below in a equivalent code
in MS-Access
...........................................................................................
Sub convSelExtPIDToShortPID()
|
by: sklett |
last post by:
I've got a strange situation here. I have a databound DataGridView that
also has un-bound columns. When the view loads, I want to update the values
of the unbound columns. If I attempt to modify the unbound column's cells
in the OnLoad() handler the results are very strange. If I add a button to
my view and update the unbound cells in the butt's handler it works fine.
Here is an example of the code I'm trying to use (it's test code):...
|
by: Patrick |
last post by:
Hello,
I want to modify an existing XML-File based on Input in a Form.
I used a DataSet to load the XML File with the ReadXml method.
I then displayed the relevant entries via the GetChildRows method.
I now want to change/add/delete those ChildRows:
How can I accomplish this?
|
by: dfm |
last post by:
Hi, I cant change the header to display images from a database. It's giving me this error :
Warning: Cannot modify header information - headers already sent by (output started at /home/content/d/f/m/dfmcons/html/secwhouse/index.php:18) in /home/content/d/f/m/dfmcons/html/secwhouse/index.php on line 71
Here is the code :
<?
mysql_connect("$host","$username", "$password");
mysql_select_db("secwhouse");
?>
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |