Solved

Delayed write to an Access db.

Posted on 2011-03-11
1
238 Views
Last Modified: 2012-05-11
Hi Experts,

I am writing data to an Access data base and then retrieving  that data immediately. I am finding that sometimes the data is not being written quickly to the db. How can I ensure that data is written to the db before the program continues execution. I have tried closing the db connection before attempting to retrieve the info. but this does not seem to help.
0
Comment
Question by:DColin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 13

Accepted Solution

by:
gamarrojgq earned 500 total points
ID: 35110078
Hi,

Try to use transacction on when you insert/update/delete the data in Access, something like this


Dim conConnection As New OleDbConnection
        conConnection.ConnectionString = "YOURSTRINGCONNECTION"
        conConnection.Open()

        Dim comCommand As New OleDbCommand
        Dim trnTranasction As OleDbTransaction

        comCommand.Connection = conConnection
        trnTranasction = conConnection.BeginTransaction
        comCommand.Transaction = trnTranasction

        comCommand.CommandText = "YOU INSERT/UPDATE/DELETE QUERY"
        Try
            comCommand.ExecuteNonQuery()
            trnTranasction.Commit()
        Catch ex As Exception
            trnTranasction.Rollback()
        End Try

        conConnection.Close()

Open in new window

0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question