Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

:-\ I have the following with an ado.net routine called.

Public Sub DoModify()
       Dim bm As BindingManagerBase = Me.DataGrid1.BindingContext(Me.DataGrid1.DataSource, Me.DataGrid1.DataMember)
       Dim dr As DataRow = CType(bm.Current, DataRowView).Row
       Dim editform As New EditTransOverride(dr)
       oldPolicyNumber = dr.Item(1)
       oldTransCode = dr.Item(2)
       oldTransEffDate = dr.Item(3)

       Dim retval As DialogResult = editform.ShowDialog()
       If retval = DialogResult.OK Then
           bm.EndCurrentEdit()
           Try
               Dim substr As String = dr.Item(4)
               If substr Is System.DBNull.Value Then
                   substr = ""
               End If
               If Not substr = "" Then
                   substr = substr.Substring(0, 2)
               End If
               ExecOnTransOverride.upd(dr.Item(1), dr.Item(2), dr.Item(3), substr, dr.Item(5), _
               dr.Item(6), dr.Item(8), dr.Item(7), DateTime.Now, dr.Item(7), _ 
               dr.Item(9), oldPolicyNumber, oldTransCode, oldTransEffDate)
               SqlDataAdapter1.Update(ds, "DsTransOverride1")
               ds.Tables("DsTransOverride1").AcceptChanges()
               MsgBox("Data Inserted Successfully !", MsgBoxStyle.Information, Me.Text)
           Catch se As SqlException
               MessageBox.Show(se.Message)
           Catch ex As Exception
               MessageBox.Show(ex.Message)
           End Try
       Else
           bm.CancelCurrentEdit()
       End If
   End Sub

Now I would like to update the datagrid with the use of the

  SqlDataAdapter1.Update(ds, "DsTransOverride1")
  ds.Tables("DsTransOverride1").AcceptChanges()

and use my ado.net routine since I tested it and it works and updates the database.

The only thing I need to do in the above routine is to update the datagrid. How do I go about doing this?

Edited by PlausiblyDamp

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...