Results 1 to 27 of 27

Thread: my program deletes the first record in my database...[RESOLVED]

Threaded View

  1. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 2004
    Location
    Philippines
    Posts
    125
    hi mendhak!

    VB Code:
    1. Private Sub btnDel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDel.Click
    2.         Dim i As String
    3.         Dim dr As DataRow
    4.         Dim cmd As String
    5.         Dim cbuild As System.Data.OleDb.OleDbCommandBuilder
    6.  
    7.         Try
    8.             BindingContext(ds, "QuoteDoc").RemoveAt(BindingContext(ds, "QuoteDoc").Position)
    9.             cbuild = New System.Data.OleDb.OleDbCommandBuilder(daDoc)
    10.             daDoc.DeleteCommand = cbuild.GetDeleteCommand
    11.             daDoc.Update(ds, "QuoteDoc")
    12.  
    13.             BindingContext(ds, "QuoteTran").RemoveAt(BindingContext(ds, "QuoteTran").Position)
    14.             ds.Tables("QuoteTran").Rows(0).Delete()
    15.             Me.BindingContext(ds, "QuoteTran").EndCurrentEdit()
    16.             cbuild = New System.Data.OleDb.OleDbCommandBuilder(daTran)
    17.             daTran.DeleteCommand = cbuild.GetDeleteCommand
    18.  
    19.             daTran.Update(ds, "QuoteTran")
    20.             MsgBox("Record deleted.", MsgBoxStyle.OKOnly, "Delete")
    21.         Catch ex As Exception
    22.         End Try
    23.     End Sub

    If you can remember, you helped me on this and told you it's working already but to my surprise, it deletes the first record of my database.

    This only happens upon loading then I go straight to my Find button then navigate through my First,Next,Previous and Last buttons but if from saving a new record it works fine.

    I hope I did not confuse you.

    If it's not too much to ask and if you're just interested, please take a look at my program that I attached here. I'm very much willing to accept suggestions and recommendations from all of you!
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width