Hello everyone,

i am developing a Library system, where user can borrow books and return them. i have a table in my DB called "borrowed books" it contains list of information about the borrowed book and the borrower, when the user returns the book the system should remove the record for that selected book.

the record is initially removed, but when i rerun the application, it is still there. i set the properties to copy if newer and removing records from other relations was successful except for this one.

the only difference is that this relation has a composite primary key. Any help is appreciated :)

i am using Access DB and vb.net

Recommended Answers

All 3 Replies

It is possible you are deleting records in the dataset (an in-memory copy of the table) but not the underlying database table. You haven't shown us any code so a definitive answer is not possible. This is one of the reasons I prefer to work with ADO rather than datasets and data tables. Fewer levels between the app and the database and fewer loose ends to tie up.

thank you for replying :)

in the form i have two list boxes where i view the list of borrowed books and there ID numbers to user upon login. the user selects a book to return and then click on "return book" button, the button contains the following: i hope the code is clear :)

 Dim returnBooknumber, index As Integer
        Dim returnbook2 As blossomDS.Borrow_ListRow
        Dim increseCopies As blossomDS.Book_ListRow

        index = bookNo_ListBox1.SelectedIndex
        returnBooknumber = bookNo_ListBox1.SelectedItem

        'first we remove it from lists then increse number of copies

            returnbook2 = BlossomDS.Borrow_List.FindByBook_noUserID(returnBooknumber, LogIn.retriveID)

        Catch ex As Exception
        End Try
        'increase number of copies
        For Each increseCopies In BlossomDS.Book_List.Rows
            If increseCopies.Book_no = returnBooknumber Then
                increseCopies.copies += 1
            End If



    End Sub
'Connect to the Access Database
                Dim Con1 As New OleDb.OleDbConnection
                Con1.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & DBFileName & ";Jet OLEDB:Database Password=password"

                Con1.Open()     'Open the new connection

                Dim deleteFirstStr As String = "DELETE * FROM TableName"
                Dim deleteFirstCMD As OleDb.OleDbCommand = New OleDb.OleDbCommand(deleteFirstStr, Con1)
                Dim deleteFirstRecord As Int32 = deleteFirstCMD.ExecuteNonQuery()

                Con1.Close()        'Close the database connection
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.