Re: Need to wait for TableAdapter.Update to finish
- From: Boris227 <adrian_morris@xxxxxxxxxxxxxx>
- Date: Tue, 8 Apr 2008 00:22:28 -0700 (PDT)
On 8 Apr, 03:31, "Steve Gerrard" <mynameh...@xxxxxxxxxxx> wrote:
Boris227 wrote:
Try
Me.DiagAddTableAdapter.Update(Me.Visir_RTDS_v3DataSet3)
Catch
MessageBox.Show("An error occurred during the update
process")
Finally
strSQL = "INSERT INTO tbl1 (a, b, c) SELECT etc ....... ;"
db.DoCmd.RunSQL(strSQL)
MessageBox.Show("Save completed")
End Try- Hide quoted text -
- Show quoted text -
My current work around is to provide a second button for all the SQL
statements after the update. Yes, it works (although presumably it
wouldn't if the user got to the second button before the update
completed) but there must be a better way.
I read your reply to Cor, but I answered here because you have the code here.
I think you are encountering a problem of using two different connections. The
line db.DoCmd.RunSQL(strSQL) is probably not using the same connection to the
database that Me.DiagAddTableAdapter.Update(Me.Visir_RTDS_v3DataSet3) is using.
The database won't fully commit the changes instantaneously, so the second
connection may or may not seem them, depending on how soon after the update it
runs. Sound familiar?
You might be able to fix it by using a transaction around the first update, and
committing it, but the better solution is to use the same connection for both
updates. That might take a little rearranging, but if you do a sequence like
Open connection
Run first update
Run second update
Close connection
you should get the data consistency you are looking for.- Hide quoted text -
- Show quoted text -
Yes, they are definitely using different connections because I just
created a new one through the DataGridView wizard. I never thought of
that. It sounds promising. I will give this a go.
.
- References:
- Need to wait for TableAdapter.Update to finish
- From: Boris227
- Re: Need to wait for TableAdapter.Update to finish
- From: Cor Ligthert [MVP]
- Re: Need to wait for TableAdapter.Update to finish
- From: Boris227
- Re: Need to wait for TableAdapter.Update to finish
- From: Boris227
- Re: Need to wait for TableAdapter.Update to finish
- From: Steve Gerrard
- Need to wait for TableAdapter.Update to finish
- Prev by Date: Re: temp directory question
- Next by Date: Re: Does anyone know any paid component can convert word/excel/image to PDF thro dll directly?
- Previous by thread: Re: Need to wait for TableAdapter.Update to finish
- Next by thread: Re: Need to wait for TableAdapter.Update to finish
- Index(es):