Home All Groups Group Topic Archive Search About

problems with compacting

Author
2 Aug 2006 12:29 PM
Selva Chinnasamy
I have had problems with Inserting records then I found the KB article which
has solution
http://support.microsoft.com/?id=884185

Now I am trying to compact the database, used JRO to compact the database,
compacting works fine.

But noticed that after compacting I get an error "can not update, update
failed".

Any help to resolve the error, or any other work around is greatly
appreciated.

Selva

Author
3 Aug 2006 6:04 AM
Kevin Yu [MSFT]
Hi Selva,

Could you post the code you use to update the database? Also, please also
post the error code, and all error messages. So that I do some more
research on this issue. Thank you!

Kevin Yu
Microsoft Online Community Support
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Author
3 Aug 2006 12:35 PM
Selva Chinnasamy
Kevin, Below is the code, I use to compact the database. Some times insert
roes works fine, but some times I get an error message "Unable to Update"
when I try to add a row to the table.

Dim db_name As String = a_Path
Dim temp_name As String = a_Path & ".temp"
Dim jro As JRO.JetEngine
jro = New JRO.JetEngine

If System.IO.File.Exists(temp_name) = True Then
    Kill(temp_name)
End If

jro.CompactDatabase("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +
db_name, _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + temp_name + ";Jet
OLEDB:Engine Type=5")

Kill(db_name)
Rename(temp_name, db_name)
System.Runtime.InteropServices.Marshal.ReleaseComObject(jro)

Thanks In Advance
Selva


Show quoteHide quote
"Kevin Yu [MSFT]" <v-k***@online.microsoft.com> wrote in message
news:STS69KstGHA.5840@TK2MSFTNGXA01.phx.gbl...
> Hi Selva,
>
> Could you post the code you use to update the database? Also, please also
> post the error code, and all error messages. So that I do some more
> research on this issue. Thank you!
>
> Kevin Yu
> Microsoft Online Community Support
> ==================================================
>
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
Author
4 Aug 2006 3:11 AM
Kevin Yu [MSFT]
Hi Selva,

When conpacting the database, you only need to specify the filename,
provider is not a requirement. But this is fine. I didn't see any other
problem in your compacting code.

In your post, you mentioned the Cannot Update error is get sometimes. Is
there any particular circumstances that generates this error? Is this error
from the Access database? If so, if you add data to Access table manually,
will you get this error again?

Kevin Yu
Microsoft Online Community Support
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Author
8 Aug 2006 8:31 AM
Kevin Yu [MSFT]
Hi Selva,

I'd like to know if this issue has been resolved yet. Is there anything
that I can help. I'm still monitoring on it. If you have any questions,
please feel free to post them in the community.

Kevin Yu
Microsoft Online Community Support

==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Author
8 Aug 2006 2:20 PM
Selva Chinnasamy
Kevin, Thanks for checking, I haven't found the solution yet.



All I like to know is how to compact the database, if the code I have
attached in my previos email isn't right.



Compacting database doesn't give any problems to me, inserting records to
the table is failing. I am trying to resolve the error with Access 2003 and
AutoNumber as posted in http://support.microsoft.com/?id=884185



Selva



Show quoteHide quote
"Kevin Yu [MSFT]" <v-k***@online.microsoft.com> wrote in message
news:0avXTUsuGHA.4396@TK2MSFTNGXA01.phx.gbl...
> Hi Selva,
>
> I'd like to know if this issue has been resolved yet. Is there anything
> that I can help. I'm still monitoring on it. If you have any questions,
> please feel free to post them in the community.
>
> Kevin Yu
> Microsoft Online Community Support
>
> ==================================================
>
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
Author
9 Aug 2006 6:39 AM
Kevin Yu [MSFT]
Hi Selva,

To compact an Access database, you can try to call DBEngine.CompactDatabase
in DAO instead of JRO. Here is an example:

http://www.developerfusion.co.uk/show/4142/

Kevin Yu
Microsoft Online Community Support
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Author
14 Aug 2006 9:37 AM
Kevin Yu [MSFT]
Hi Selva,

Does this answer your question? Anything I can do to help?

Kevin Yu
Microsoft Online Community Support
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)