Well Hello daniweb,
I want to point out that I am barely beginning to learn VB.net for my A-Level Computing Course.

So, I was asked to make a Currency Conversion Program and make it have a Transaction Log that is automatically updated when the user makes a conversion. I chose not to use buttons when converting, making use of the TextBox.TextChanged and ComboBox.SelectedIndexChanged.

I have an Access Database with a table called "tbl_Transaction" for my transaction log and I use the System.Data.OleDb. Here is the part of the code responsible for updating the "tbl_Transaction" table.

    Dim da As OleDb.OleDbDataAdapter
    Dim dSet As New DataSet
    Dim sqlStat As String = "SELECT * FROM tbl_Transaction"

    Dim cb As New OleDb.OleDbCommandBuilder(da)
    Dim dsNewRow As DataRow


    Private Sub SaveToLog()
            da = New OleDb.OleDbDataAdapter(sqlStat, cnn)
            da.Fill(dSet, "TransactionLog")

            dsNewRow = dSet.Tables("TransactionLog").NewRow()

            dsNewRow.Item(1) = ComboBoxFrom.Text
            dsNewRow.Item(2) = ComboBoxTo.Text
            dsNewRow.Item(3) = CurrencyFrom.Text
            dsNewRow.Item(4) = CurrencyTo.Text



            da.Update(dSet, "TransactionLog")
            MsgBox("Transaction Logged to DB")
        Catch ex As Exception
            MsgBox("Error writing to Transaction Log!")
        End Try
    End Sub

Even if I get the message "Transaction Logged to DB", the table stays unchanged, can you guys help me?

Edited by bogdan.buduroiu

3 Years
Discussion Span
Last Post by Reverend Jim

You might have to set your command for the update:

da.UpdateCommand = New OleDBCommandBuilder(da).GetUpdateCommand()

Then issue the update.

See if this helps.


A transaction log does not necessarily imply a database. It could be as simple as one or more files of the form name.log which could be simple text files. That's what I used for several dozen applications in my corporate environment. If the name is of the form yyyy-mm-dd.log or yyyy-mm.log then you can keep the log files from growing indefinitely. All you would have to do is open the file for append (create if not present). That simplifies the complexity and the code considerably. It also means you don't need a special program to view the logs. It also makes it easier to search with something like GREP.

Edited by Reverend Jim

Votes + Comments
Might help if I read the question a little better next time, huh?
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.