473,498 Members | 1,724 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Update DataSet or DataTable

Hi,

Can I update a DataSet or a DataTable using something like object.Update()
???

I was looking for something and I find out this functions, but I don't know
for real what they do.
AcceptChanges()
BeginEdit()
EndEdit()

I try to use them like this, to change the value of a field in first row:
ds.Tables("P").Rows(0).AcceptChanges()
ds.Tables("P").Rows(0).BeginEdit()
ds.Tables("P").Rows(0).Item("Num") = 9999
ds.Tables("P").Rows(0).EndEdit()
But it doesn't work.
Can I do something like this???
--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca
Nov 20 '05 #1
3 20819
"ruca" <ru***@iol.pt> schrieb

I removed the ASP group from the list. (yes, you're an ASP.Net programmer,
though the question is not about ASP.Net. I'm a Nissan driver an don't post
my VB questions in the Nissan group (only mentioned to clarify how to choose
a group))
Can I update a DataSet or a DataTable using something like
object.Update() ???

I was looking for something and I find out this functions, but I
don't know for real what they do.
AcceptChanges()
BeginEdit()
EndEdit()

I try to use them like this, to change the value of a field in first
row: ds.Tables("P").Rows(0).AcceptChanges()
ds.Tables("P").Rows(0).BeginEdit()
ds.Tables("P").Rows(0).Item("Num") = 9999
ds.Tables("P").Rows(0).EndEdit()
But it doesn't work.
Can I do something like this???


What do you want to update? The database? If you do:
http://msdn.microsoft.com/library/de...terdataset.asp
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2
If you are using a DataAdapter to handle the DataSet you can use:

DataAdapter.Update(Dataset)

/Lars
"ruca" <ru***@iol.pt> skrev i meddelandet
news:uo**************@TK2MSFTNGP09.phx.gbl...
Hi,

Can I update a DataSet or a DataTable using something like object.Update()
???

I was looking for something and I find out this functions, but I don't know for real what they do.
AcceptChanges()
BeginEdit()
EndEdit()

I try to use them like this, to change the value of a field in first row:
ds.Tables("P").Rows(0).AcceptChanges()
ds.Tables("P").Rows(0).BeginEdit()
ds.Tables("P").Rows(0).Item("Num") = 9999
ds.Tables("P").Rows(0).EndEdit()
But it doesn't work.
Can I do something like this???
--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca

Nov 20 '05 #3
Hi Ruca,
Can I update a DataSet or a DataTable using something like object.Update()
This code you wrote you can use, ds.Tables("P").Rows(0).Item("Num") = 9999


I think that the rest you wrore is useles for you,

And than you have normaly in the simple way to make the following code(which
is all typed in this message without checking)

dim connection as new xxx connection(connectionstring)
dim da as new xxxdataadapter(selectstring, connection)
dim cmb as new commandbuilder(da)
if ds.haschanges
da.update(ds)
end if

and the last part in a try catch end try block.
Normaly it is not needed to open and close the connection, that does the
dataadapter himself.
(he closes only a from himself opened connection)

I hope this helps something

Cor
Nov 20 '05 #4

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

Similar topics

2
1619
by: ruca | last post by:
Hi, Can I update a DataSet or a DataTable using something like object.Update() ??? I was looking for something and I find out this functions, but I don't know for real what they do....
9
12951
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...
10
27808
by: Bernie Yaeger | last post by:
I have a need to add a primary key to a dataset/datatable. How can this be done using a standard oledb data provider? Tx for any help.
4
11147
by: George | last post by:
Got a question about the side effect of DataAdapter.Update() and DataTable.GetChanges(). Say I set up a DataTable and a DataAdapter in a class. Delete (Not remove) a row in the data table and...
0
1261
by: AboutJAV | last post by:
Hi, I added a datagrid. When the user make changes to the cells, the datatable was updated with the new values. I need to update the dataset.datatable with the current datatable, but an error...
1
12104
by: Tim Kelley | last post by:
I need to loop through a datatable and update a particular field. This seems like it should be fairly easy but it is giving me fits. Here is the code that I have so far. foreach (DataRow row...
2
1882
by: Mr. Arnold | last post by:
I am working a C# project that uses what's in the subject. I kind of have the basics down on reading the table data. I don't use the above methods of data access or persistence, but I am stuck...
1
1577
nev
by: nev | last post by:
dataset.datatable.adddatatablerow("john", "rambo") datatabletableadapter.update(dataset.datatable) when i view my mysql table using navicat, the row was not added. i tried adding...
3
7380
by: ASPnewb1 | last post by:
I am currently filling a dataTable then adding this table to a dataset, setting the dataset to the Gridview's datasource. If I set the Gridview to generate columns automatically it will fill the...
4
19665
by: =?Utf-8?B?RnJhbmsgVXJheQ==?= | last post by:
Hi all I have a DataSet with one table filled. From this DataSet (DataTable), I need to create a SqlDataReader. Does anybody knows how to do this ? Is it possible ?? Thanks for any help.
0
7005
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
7168
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,...
0
7210
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...
0
7381
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...
0
5465
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,...
0
3087
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1424
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 ...
1
659
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
293
bsmnconsultancy
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...

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.