Re: Data Update Problem
- From: "Mark Ashton" <markash@xxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 20 Sep 2005 11:22:54 -0700
GetChanges wil get a copy of the DataSet that contains all changes made to
it since it was loaded or since AcceptChanges was last called.
Documentation on EndCurrentEdit seems to imply it will call AcceptChanges,
if this is BindingSource you may be more interested in calling EndEdit
instead which applies pending changes to the underlying data source.
' this sample shows GetChanges will do something
Sub Main()
Dim ds As New DataSet("MyDataSet")
Dim dt As DataTable = ds.Tables.Add("MyTable")
Dim dc As DataColumn = dt.Columns.Add("MyColumn")
Dim dr As DataRow = dt.NewRow
dr.Item(dc) = "hello"
dt.Rows.Add(dr)
Dim changes As DataSet = ds.GetChanges
changes.WriteXml(System.Console.Out)
End Sub
--
This posting is provided "AS IS", with no warranties, and confers no rights.
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.
"Will" <Will@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:B81F8DAF-25FB-4520-8CD8-C1C6C0DB49D7@xxxxxxxxxxxxxxxx
>I have the following code section which is intended to update a dataset
>with
> changes made in a windows-based form. The problem is its not recognising
> any
> changes having been made at all, despite the fact there clearly have been.
> Can anyone suggest where I've gone wrong please.
> Many thanks
> WAM
>
> Public Sub UpdateDataSet()
> 'Create copy dataset
> Dim objDataSetChanges As SelfBuild.selfbuildDS = New
> SelfBuild.selfbuildDS
> Me.BindingContext(dsSelfBuild, "SelfBuild").EndCurrentEdit()
> 'Get changes
> objDataSetChanges = CType(dsSelfBuild.GetChanges,
> SelfBuild.selfbuildDS)
> 'Find out if changes have been made, this is where its not picking
> anything up
> If (Not (objDataSetChanges) Is Nothing) Then
> MsgBox("Success")
> Try
> 'blah.......................................
.
- Prev by Date: Re: Querying Mutliple Databases
- Next by Date: Re: Why does query take 1 minute or two hours to run?
- Previous by thread: How to solve the error:Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
- Next by thread: Error accessing Oracle date fields
- Index(es):
Relevant Pages
|
|