473,811 Members | 3,208 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Q: Updating a single row

Hi

Using code like:

dataAdaptor1.Up date(dataSet1.T able("MyTable") )

it is possible to update a datasource with all the rows in MyTable.

What is the code to update a certain row in MyTable?

Thanks in advance

Geoff
Nov 20 '05 #1
3 1352
Geoff,
DataAdapter.Upd ate is overloaded to accept a DataSet, a DataTable, or an
array of DataRows, to update a single row I would put the single row in an
array by itself, then call Update with this array.

Something like:
Dim rows() As DataRow
' do something to fill the rows array with a single row
rows = dataSet1.Table( "MyTable").Sele ct(...)
dataAdaptor1.Up date(rows)

For example I have a project that uses:

Dim rows() As DataRow
' do something to fill the rows array with a single row
rows = dataSet1.Table( "MyTable").Sele ct(Nothing, Nothing,
DataViewRowStat e.Added)
dataAdaptor1.Up date(rows)
Which will cause all the added rows in my datatable to be deleted from the
database, without effecting the Deleted or Modified rows. I then do the
Modified rows, followed by the Deleted rows.

Hope this helps
Jay

"Geoff Jones" <ge***@NODAMNSP AM.com> wrote in message
news:40******** *************@n ews.dial.pipex. com...
Hi

Using code like:

dataAdaptor1.Up date(dataSet1.T able("MyTable") )

it is possible to update a datasource with all the rows in MyTable.

What is the code to update a certain row in MyTable?

Thanks in advance

Geoff

Nov 20 '05 #2
Many thanks Jay

"Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> wrote in message
news:uj******** ******@TK2MSFTN GP09.phx.gbl...
Geoff,
DataAdapter.Upd ate is overloaded to accept a DataSet, a DataTable, or an
array of DataRows, to update a single row I would put the single row in an
array by itself, then call Update with this array.

Something like:
Dim rows() As DataRow
' do something to fill the rows array with a single row
rows = dataSet1.Table( "MyTable").Sele ct(...)
dataAdaptor1.Up date(rows)

For example I have a project that uses:

Dim rows() As DataRow
' do something to fill the rows array with a single row
rows = dataSet1.Table( "MyTable").Sele ct(Nothing, Nothing,
DataViewRowStat e.Added)
dataAdaptor1.Up date(rows)
Which will cause all the added rows in my datatable to be deleted from the
database, without effecting the Deleted or Modified rows. I then do the
Modified rows, followed by the Deleted rows.

Hope this helps
Jay

"Geoff Jones" <ge***@NODAMNSP AM.com> wrote in message
news:40******** *************@n ews.dial.pipex. com...
Hi

Using code like:

dataAdaptor1.Up date(dataSet1.T able("MyTable") )

it is possible to update a datasource with all the rows in MyTable.

What is the code to update a certain row in MyTable?

Thanks in advance

Geoff


Nov 20 '05 #3
Doh!

I hate changing samples in mid stream. :-)
rows = dataSet1.Table( "MyTable").Sele ct(Nothing, Nothing,
DataViewRowStat e.Added) Which will cause all the added rows in my datatable to be deleted from the Should read "which will cause all the added rows in my datatable to be added
to the database".

Jay

"Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> wrote in message
news:uj******** ******@TK2MSFTN GP09.phx.gbl... Geoff,
DataAdapter.Upd ate is overloaded to accept a DataSet, a DataTable, or an
array of DataRows, to update a single row I would put the single row in an
array by itself, then call Update with this array.

Something like:
Dim rows() As DataRow
' do something to fill the rows array with a single row
rows = dataSet1.Table( "MyTable").Sele ct(...)
dataAdaptor1.Up date(rows)

For example I have a project that uses:

Dim rows() As DataRow
' do something to fill the rows array with a single row
rows = dataSet1.Table( "MyTable").Sele ct(Nothing, Nothing,
DataViewRowStat e.Added)
dataAdaptor1.Up date(rows)
Which will cause all the added rows in my datatable to be deleted from the
database, without effecting the Deleted or Modified rows. I then do the
Modified rows, followed by the Deleted rows.

Hope this helps
Jay

"Geoff Jones" <ge***@NODAMNSP AM.com> wrote in message
news:40******** *************@n ews.dial.pipex. com...
Hi

Using code like:

dataAdaptor1.Up date(dataSet1.T able("MyTable") )

it is possible to update a datasource with all the rows in MyTable.

What is the code to update a certain row in MyTable?

Thanks in advance

Geoff


Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
11603
by: pb648174 | last post by:
I have a single update statement that updates the same column multiple times in the same update statement. Basically i have a column that looks like .1.2.3.4. which are id references that need to be updated when a group of items is copied. I can successfully do this with cursors, but am experimenting with a way to do it with a single update statement. I have verified that each row being returned to the Update statement (in an...
2
2411
by: Ray Holtz | last post by:
I have a form that shows a single record based on a query criteria. When I click a button it is set to use an append query to copy that record to a separate table, then deletes the record from the first table. Both tables have a 'DateTime' field that shows when it was last updated using the Now function. What I am trying to do is get the 'DateTime' field updated after the append query copies it to the new table. I have tried updating...
1
2617
by: Ken | last post by:
Help! I have a MS Access database made up of a single table. The data updates for this database comes in the form of a single Excel spreadsheet, which is imported into the database table. I need to break-out this single database table, into multiple tables to better structure the database and reduce the need to input the same data repeatedly.
1
1747
by: Prem | last post by:
Hi All I have a portal application that we have built that contains links to different modules. There is no static binding to these dlls from the application so that we can deploy some modules to some users and some modules to other users. This allows us to have a centralized application that contains all modules...but with the ability to have security for different groups of users. My question, is it possible to update just a one dll...
3
1315
by: Doug | last post by:
Scenario: I select data from a SQL Server View which links 3 tables, into a single dataset table. I update some of those fields on a web form. When I want to update the db, clearly I can't update via a View - makes perfect sense. But because I used a View, I can't use the CommandBuilder. I have to specify my own Commands which will in some cases be huge and complex. This seems crazy - what if I change the db structure? And because I...
0
1642
by: cwbp17 | last post by:
I'm having trouble updating individual datagrid cells. Have two tables car_master (columns include Car_ID, YEAR,VEHICLE) and car_detail (columns include Car_ID,PRICE,MILEAGE,and BODY);both tables have a FK relationship on CAR_ID so the oracledataadapter1 select statement(CommandText) is: select car_master.car_id, car_master.year,car_master.vehicle,car_detail.car_id AS EXPR1,
0
1000
by: jchavez | last post by:
When updating a column from a single row in a table from one server that is in replication with another server why doesn't the whole row update? Example Server 1 Table:CustomerInfo Columns: ID, Customer, Address, Status Data:
5
10039
by: =?Utf-8?B?U29tIE5hdGggU2h1a2xh?= | last post by:
i have data table containg 5000 rows to update it i am using foreach loop an updating very row with same value. buts its too slow.is there any way to update all the rows in single. foreach(datarow dr in dt.rows) { dr="abcd"; dr="xyz"; } instead of using for loop can i update hole column in single time.
0
1772
by: Mogrin | last post by:
So I have this windows .net form app, and I have the following goals: -Needs to be 1 single file, the executable, in any directory the user decides to download it to. No installation folder, no launcher/updater app, no registry entries. -App to automatically check for updates, ask permission from user, update app, and relaunch.(if necessary) I've never done this before, so I don't know the correct way to go about this, and my...
0
9734
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9607
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,...
0
10656
Oralloy
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...
0
10397
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10138
tracyyun
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...
0
9214
agi2029
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...
0
6897
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();...
0
5700
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4353
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.