473,383 Members | 1,785 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,383 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 18 '05 #1
2 1617
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 18 '05 #2
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 18 '05 #3

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

Similar topics

2
by: Chris | last post by:
I'm using a DataTable in my application. I am able to load rows into the DataTable quickly. What's puzzling me, however, is that when I update a set of cells in the DataTable, the update is really...
4
by: steroche | last post by:
I would REALLY appreciate help please please please! Im sure it is probably blindingly obvious to most of you but I am totally in the dark here!I am lost - i thought i had finally figured out this...
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...
8
by: Zorpiedoman | last post by:
I keep getting a concurrency exception the second time I make a change and attempt to update a dataadapter. It appears this is by design, so there must be something I can do to avoid it. ...
1
by: Joaquin | last post by:
OK, I hate myself for asking this, it's the worst question I have ever asked but it's worse not to ask: ¿How do I update a datatable in vs 2005? I mean, I am using a typed dataset, a...
3
by: RSH | last post by:
Hi, I have a situation in where i have two instances of SQL server, the first is our Production Environment, the second is our Development environment. Both servers contain the same databases...
4
by: George | last post by:
Hi all, I am having trouble with updating my data in an Access database. here is my code: Imports System.Data.OleDb Dim AppPath As String = Mid(Application.ExecutablePath, 1,...
15
by: Scotty | last post by:
I like to have a good insert, update and delete code The code below sometimes workl ok sometimes doesnt work, what i am doing wrong?? Sub SaveAny() Dim command_builder As New...
2
by: Scotty | last post by:
I get stuck to write an update, insert and delete command, i am looking for some help to start Whats the best way to update 2 tables toe the database (Access) below my code used to load my...
2
by: BobLewiston | last post by:
Some of you may have seen my earlier thread “PasswordHash NULL problem”. I’ve started a new thread because investigation has shown that the problem is actually quite different than I previously...
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: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.