By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,967 Members | 1,690 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,967 IT Pros & Developers. It's quick & easy.

Update DataSet or DataTable

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.