Insert into Access DB, Delayed Insert

Oct 5, 2010 at 2:27 AM

I was using this to insert a record into an Access database, and then reload a drop down.  When I use DbNetData, the record inserts into the database, but is not there when the drop down reloads as the next step.  When I change it to a straight DbCommand object with a populated insert statement with the same next step of reloading the record is there.  Am I missing something on the delay of the insert (This is in an ASP.NET page, the DbNetData is declared at the start of the page cycle and it's cleaned up at the end, no transaction created)?  

This insert does work, but the new inserted record is not there when LoadContentDropDown() is called.

        Dim insert As New CommandConfig("PAGE_CONTENT")
        insert.Params("CONTENT_ID") = txtAddContent.Text
        insert.Params("DESCRIPTION") = txtAddContent.Text
        insert.Params("PAGE_CONTENT") = txtContent.Text

        Dim counter As Integer = Me.Database.ExecuteInsert(insert)
        Call LoadContentDropDown()

 This one works without delay, the record is there when LoadContentDropDown() is called:

        Dim command As OleDbCommand = Me.Connection.CreateCommand
        command.CommandText = "Insert Into PAGE_CONTENT(CONTENT_ID, DESCRIPTION, PAGE_CONTENT) Values (@CONTENT_ID, @DESCRIPTION, @PAGE_CONTENT)"
        command.Parameters.AddWithValue("@CONTENT_ID", txtAddContent.Text)
        command.Parameters.AddWithValue("@DESCRIPTION", txtAddContent.Text)
        command.Parameters.AddWithValue("@PAGE_CONTENT", txtContent.Text)
        command.ExecuteNonQuery()

        Call LoadContentDropDown()