Learn how to a build a cloud-first strategyRegister Now

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

Sql Update

Hi Experts

When I use the following code
          CS.Open()
           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
    'Update
           CS.Open()
           cmdBuilder = New SqlCommandBuilder(DA)
            DA.Update(DS, "Codes")
     'Fill DS
            DA.Fill(DS, "Codes")
            CS.Close()
            dt3 = DS.Tables("codes")
But it still have the old values. Unless I go out the form and debug again.
Please help
0
b001
Asked:
b001
1 Solution
 
CodeCruiserCommented:
Try disposing the Adapter and the dataset and recreate the objects.
0
 
regevhaCommented:
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.
0

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