473,385 Members | 1,356 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,385 software developers and data experts.

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 20810
"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
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
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
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
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
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
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
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
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
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
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.
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.