Wrox Programmer Forums
|
Pro VB Databases Advanced-level VB coding questions specific to using VB with databases. Beginning-level questions or issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 2nd, 2005, 12:57 PM
Registered User
 
Join Date: Nov 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem with ADODC and Access

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
 
Old June 10th, 2006, 10:31 AM
Registered User
 
Join Date: Jun 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Was getting the same all of a sudden on applications which were fine for years !! Now on XP SP2 and getting this rubbish !

I have a small workaround.

I created a new module (NewMOD.bas)
it contains the following

Public Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)

-----------------------------------------------------

I placed the following before each .Refresh

sleep 10

The problem was gone

my code was -

With adoCur
        .ConnectionString = cndb
        .CommandType = adCmdUnknown
        .RecordSource = "SELECT * FROM Curr "
        .Refresh ' Failing here
    End With

Now my code is -

With adoCur
        .ConnectionString = cndb
        .CommandType = adCmdUnknown
        .RecordSource = "SELECT * FROM Curr "
        sleep 10
        .Refresh
    End With

This works for me - can people let me know if it works for them !

I am aware that this is a workaround as opposed to a fix - keepm me updated..







 
Old June 12th, 2006, 04:06 AM
Registered User
 
Join Date: Jun 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by JohnRS4
 Was getting the same all of a sudden on applications which were fine for years !! Now on XP SP2 and getting this rubbish !

I have a small workaround.

I created a new module (NewMOD.bas)
it contains the following

Public Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)

-----------------------------------------------------

I placed the following before each .Refresh

sleep 10

The problem was gone

my code was -

With adoCur
        .ConnectionString = cndb
        .CommandType = adCmdUnknown
        .RecordSource = "SELECT * FROM Curr "
        .Refresh ' Failing here
    End With

Now my code is -

With adoCur
        .ConnectionString = cndb
        .CommandType = adCmdUnknown
        .RecordSource = "SELECT * FROM Curr "
        sleep 10
        .Refresh
    End With

This works for me - can people let me know if it works for them !

I am aware that this is a workaround as opposed to a fix - keepm me updated..




After painstakingly rolling back updates and stripping out applications right back to a bare XP SP2 install - I still had this error.

So I decided to reinstall windows XP sp2 - I deployed my application as usual and it worked without a problem !!!

While I was happy with this - I thought back - when XP was initially installed on this machine 'Format the partition was NTFS'(QUICK) was chosen. So I repeated this scenario using Quick format instead of a full format - and I had the same problem !!!

So stay clear of the Quick Format option on an XP install..

Suffice to say I am still shocked by this whole thing..

I hope this can help someone else..


 
Old June 12th, 2006, 09:56 AM
Registered User
 
Join Date: Jun 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

When I had the error these were the symptoms -


Running Compiled application
---------------------------
with runtime error -2147467259(80004005)
Automation error
Unspecified error


Running Code with the IDE
-------------------------
runtime error -2147467259(80004005)
Method 'Refresh' of object 'IAdodc' failed.


I went through the mill with this but got no specific answer - After all these were applications which were running faultlessy for the last number of years.

I decided to play a little with the code .... I did the following

created a new module (newmod.bas)
and entered the following -

Public Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)

-----------------------

Then before each .refresh method I put the following

Sleep 10

- it worked !!!! - I know this is not a cure but a work around - I needed to do something and had spent a long time playing around with MDAC ,JET ,Pathces and needed to sort the issue

My edited code looks thus -

Dim strSQL As String
Dim rsCur As New ADODB.Recordset
With adoCur
.ConnectionString = cndb
.CommandType = adCmdText


.RecordSource = "SELECT * FROM Curr "
Sleep 10 ' New addition
.Refresh ' previous fail point
End With


But now I know what cures it as opposed to a work around...

The only reason I decided to go through this whole scenario was the fact that I knew the application was working for years on various flavours of operating systems without a problem..

Had this been a new app - I would have been questioning my methods !



 
Old June 11th, 2007, 04:54 AM
Registered User
 
Join Date: Jun 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi to all...
I m new to this Forum...I felt very happy..to get this error on this
forum...and thought that i 'll find the solution...but couldn't found...

  adoObj.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & AppDir & "\School_data.mdb;Persist Security Info=False;

    adoObj.CommandType = adCmdTable

    adoObj.RecordSource = AdoRec

    adoObj.Refresh 'here i got the error...

    i have also used the Sleep function (API Call) have sp2 xp window but the proble is not solved ...can anyone plz help me...i have only 2 days to deploy the software to the client...plz help me..:(

Sp Singh
 
Old June 11th, 2007, 07:20 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there.. and your error is??? (what message do you receive??)

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
use adodc in vb 2005 fiori Visual Basic 2005 Basics 3 July 20th, 2007 08:04 AM
ADODC PROBLEM cnkumar74 VB Components 0 February 16th, 2007 03:27 AM
adodc and flexgrid! smileii VB Databases Basics 6 October 18th, 2006 01:33 PM
Trouble with ADODC ctrl nav1 VB How-To 3 June 21st, 2005 09:19 AM
Datagrid and ADODC cindy Beginning VB 6 1 November 11th, 2003 04:28 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.