Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 202
  • Last Modified:

Sql Update

Hi Experts

When I use the following code
           cmdBuilder = New SqlCommandBuilder(DA)
            DA.Update(DS, "Codes")

It doesnot update untill the programe END
What I like to do is Update then fill the DS with new setting and carry on working without going out of the form
I tried the following
           cmdBuilder = New SqlCommandBuilder(DA)
            DA.Update(DS, "Codes")
     'Fill DS
            DA.Fill(DS, "Codes")
            dt3 = DS.Tables("codes")
But it still have the old values. Unless I go out the form and debug again.
Please help
1 Solution
Try disposing the Adapter and the dataset and recreate the objects.
Try to add "DS.AcceptChanges()" after the "DA.Update(...)" line - http://msdn.microsoft.com/en-us/library/system.data.dataset.acceptchanges(v=vs.71).aspx 

It is not clear exactly what are your data processing requirements. Please attach a sample code (complete .NET project) and we will be able to assist you and provide you with modified code that solves the problem.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now