Latha WS

Latha WS

  • NA
  • 2
  • 0

What's the problem with this code

Aug 12 2006 1:54 AM

Hi,

I just tried to update my table data... It did not shown any error... but not updating..
I could not find what mistake I did in this..
Please help me...

            Dim DSet As DataSet
            Dim Con As New SqlConnection(GetConnection)
            Dim DAdapter As SqlDataAdapter
            Dim DTble As DataTable
            Dim Qry As String
            Dim CmdBuilder As SqlCommandBuilder
            Dim DRow As DataRow
            Con.Open()
            DSet = New DataSet
            Qry = "SELECT * FROM BATCHES where [batch code]=15"
            DAdapter = New SqlDataAdapter(Qry, Con)
            DAdapter.Fill(DSet, "Batches")
            DTble = DSet.Tables("Batches")
            DRow = DTble.Rows(0)
            DRow.BeginEdit()
            DRow("Stock") = DRow("Stock") - 1
            DRow.AcceptChanges()
            DRow.EndEdit()
            CmdBuilder = New SqlCommandBuilder(DAdapter)
            DAdapter.Update(DSet, "Batches")


Answers (1)