PC Review


Reply
Thread Tools Rate Thread

Current users and Repair

 
 
canann
Guest
Posts: n/a
 
      18th Mar 2009
Can anyone show me how to programatically list the current users of an .mdb
(2000) file when it is open.

Any if anyone has a snippet to REPAIR a database progamatically that would
be great.

I need this in c# but will take it vb .

Thanks in advance
 
Reply With Quote
 
 
 
 
Douglas J. Steele
Guest
Posts: n/a
 
      18th Mar 2009
For one solution to your first question, see
http://support.microsoft.com/kb/198755/EN-US/

What exactly are you looking for for the second one? You don't repair a
database from inside it. You can create a shortcut that allows the user to
run repair on the database should they get prompted for it.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"canann" <(E-Mail Removed)> wrote in message
news:67DE4644-C401-49A0-9EA2-(E-Mail Removed)...
> Can anyone show me how to programatically list the current users of an
> .mdb
> (2000) file when it is open.
>
> Any if anyone has a snippet to REPAIR a database progamatically that would
> be great.
>
> I need this in c# but will take it vb .
>
> Thanks in advance



 
Reply With Quote
 
canann
Guest
Posts: n/a
 
      19th Mar 2009
Thanks Douglas, I have looked at the first solution and am converting it run
under (VS C#) .


Can you explain how to -

{You can create a shortcut that allows the user to
run repair on the database should they get prompted for it. }

I have an application (VS C#) that uses Access as a shared db. When the file
is corrupt I would like for any of the users to be able to repair/compact.

The users will not have Access installed - the admin does have Access
installed.


Any help would be appreciated.





"Douglas J. Steele" wrote:

> For one solution to your first question, see
> http://support.microsoft.com/kb/198755/EN-US/
>
> What exactly are you looking for for the second one? You don't repair a
> database from inside it. You can create a shortcut that allows the user to
> run repair on the database should they get prompted for it.
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no private e-mails, please)
>
>
> "canann" <(E-Mail Removed)> wrote in message
> news:67DE4644-C401-49A0-9EA2-(E-Mail Removed)...
> > Can anyone show me how to programatically list the current users of an
> > .mdb
> > (2000) file when it is open.
> >
> > Any if anyone has a snippet to REPAIR a database progamatically that would
> > be great.
> >
> > I need this in c# but will take it vb .
> >
> > Thanks in advance

>
>
>

 
Reply With Quote
 
Douglas J. Steele
Guest
Posts: n/a
 
      19th Mar 2009
If the users don't have Access installed, then they won't be able to do it
using a shortcut as I originally suggested. Do you have a reference set to
DAO? If so, you might be able to use the RepairDatabase method of the
DBEngine object. It's as simple as:

DBEngine.RepairDatabase dbname

The dbname argument is a String that is the path and file name for an
existing Microsoft Jet database file. If you omit the path, only the current
directory is searched. If your system supports the uniform naming convention
(UNC), you can also specify a network path, such as
"\\server1\share1\dir1\db1.mdb".

From the Help file:

"You must close the database specified by dbname before you repair it. In a
multiuser environment, other users can't have dbname open while you're
repairing it. If dbname isn't closed or isn't available for exclusive use,
an error occurs.

This method attempts to repair a database that was marked as possibly
corrupt by an incomplete write operation. This can occur if an application
using the Microsoft Jet database engine is closed unexpectedly because of a
power outage or computer hardware problem. The database won't be marked as
possibly corrupt if you use the Close method or if you quit your application
in a usual way.

The RepairDatabase method also attempts to validate all system tables and
all indexes. Any data that can't be repaired is discarded. If the database
can't be repaired, a run-time error occurs.

When you attempt to open or compact a corrupted database, a run-time error
usually occurs. In some situations, however, a corrupted database may not be
detected, and no error occurs. It's a good idea to provide your users with a
way to use the RepairDatabase method in your application if their database
behaves unpredictably.

Some types of databases can become corrupted if a user ends an application
without closing Database or Recordset objects and the Microsoft Jet database
engine; Microsoft Windows doesn't have a chance to write data caches to
disk. To avoid corrupt databases, establish procedures for closing
applications and shutting down systems that ensure that all cached pages are
saved to the database. In some cases, power supplies that can't be
interrupted may be necessary to prevent accidental data loss during power
fluctuations.

Note After repairing a database, it's also a good idea to compact it using
the CompactDatabase method to defragment the file and to recover disk
space."

Depending on what version of Jet was used to create the database file, you
might be able to use JetComp.exe. See
http://support.microsoft.com/kb/295334/EN-US/ for details (and while it
doesn't list it, it should work with Access 2003 as well)

Generically, you may find the Corrupt Microsoft Access MDBs FAQ that Tony
Toews has at http://www.granite.ab.ca/access/corruptmdbs.htm interesting
reading, as well as http://www.datarevive.com/repair.htm

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"canann" <(E-Mail Removed)> wrote in message
news:76EA1376-FAFA-4BD4-8F9B-(E-Mail Removed)...
> Thanks Douglas, I have looked at the first solution and am converting it
> run
> under (VS C#) .
>
>
> Can you explain how to -
>
> {You can create a shortcut that allows the user to
> run repair on the database should they get prompted for it. }
>
> I have an application (VS C#) that uses Access as a shared db. When the
> file
> is corrupt I would like for any of the users to be able to
> repair/compact.
>
> The users will not have Access installed - the admin does have Access
> installed.
>
>
> Any help would be appreciated.
>
>
>
>
>
> "Douglas J. Steele" wrote:
>
>> For one solution to your first question, see
>> http://support.microsoft.com/kb/198755/EN-US/
>>
>> What exactly are you looking for for the second one? You don't repair a
>> database from inside it. You can create a shortcut that allows the user
>> to
>> run repair on the database should they get prompted for it.
>>
>> --
>> Doug Steele, Microsoft Access MVP
>> http://I.Am/DougSteele
>> (no private e-mails, please)
>>
>>
>> "canann" <(E-Mail Removed)> wrote in message
>> news:67DE4644-C401-49A0-9EA2-(E-Mail Removed)...
>> > Can anyone show me how to programatically list the current users of an
>> > .mdb
>> > (2000) file when it is open.
>> >
>> > Any if anyone has a snippet to REPAIR a database progamatically that
>> > would
>> > be great.
>> >
>> > I need this in c# but will take it vb .
>> >
>> > Thanks in advance

>>
>>
>>



 
Reply With Quote
 
David W. Fenton
Guest
Posts: n/a
 
      19th Mar 2009
=?Utf-8?B?Y2FuYW5u?= <(E-Mail Removed)> wrote in
news:76EA1376-FAFA-4BD4-8F9B-(E-Mail Removed):

> I have an application (VS C#) that uses Access as a shared db.
> When the file is corrupt I would like for any of the users to be
> able to repair/compact.


Use DAO's CompactDatabase command. If you're using ADO, then you'll
have to use JRO for that.

But you really need to make sure you're not running your app in an
environment that is unsuitable for Jet. If you're just planning for
something that might happen once in a blue moon, sure, OK. But if
you are experiencing frequent corruptions, then that's a different
story entirely and you need to figure out what's causing the
corruption and fix that problem.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error 7846 Can't compact and repair current database =?Utf-8?B?RGFiYXVt?= Microsoft Access Form Coding 2 17th Oct 2006 12:27 AM
repair XP Home, won't let me, says current version is newer than C =?Utf-8?B?UmVkIERvZw==?= Windows XP Performance 4 5th Feb 2006 05:46 PM
Check the user is a member of a domain users or current system users Venkat Microsoft C# .NET 0 20th May 2005 04:19 PM
Freeware comparisons for repair of current RPC exploit Knack Windows XP General 0 13th Aug 2003 02:01 AM
Repair Install-Affect Current Programs George Emslie Windows XP Basics 0 14th Jul 2003 07:05 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:51 AM.