Hi, I am developing a Visual Basic application interacting with an Access database, by mean of ADO controls. I need the data from the database to paint and refresh a graphic, so I have a timer and inside of that timer I update the database, take the data from the database and paint them in the graphic. But I have a problem, in the beginning the program works ok, but after passing through the timer several times (about 50 times) the program fails with the following message:
Run-time error '-2147467259 (80004005)';
Unespecified error.
Method 'Refresh' of object 'IAdodc' failed.
I have looked for a solution in many sites but I havent found one yet. I am working with Windows XP SP1, Visual Basic 6.0 SP5, Access 2002 SP2 and MDAC 2.7 SP1. Could it be a problem with the MDAC? If anybody has a suggestion or has had a problem similar to this, I would be very grateful if u could inform me. Thank you!!!
The code is like this (TGraphicData is a Microsoft ADO Data Control SP4 (OLEDB)):
Code:
With TGraphicData
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Persist Security Info=False;" & _
"Data Source=" & DBPath & _
"; Mode=Read|Write"
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.CommandType = adCmdText
.RecordSource = "SELECT * FROM TGraphicData"
.Refresh
End With
Private Sub Timer1_Timer()
Timer1.Enabled=False
'
' (update the database)
'
TGraphicData.Refresh 'here appears the error
'
' (paint the graphic)
'
Timer1.Enabled=True
End Sub