Bonjour,
Je voudrais savoir comment faire pour reparer et ou compacter une base de donnees Access 97 en ado.net sous vb.net 2005?
Merci de m'aider.
Bonjour,
Je voudrais savoir comment faire pour reparer et ou compacter une base de donnees Access 97 en ado.net sous vb.net 2005?
Merci de m'aider.
Bonjour,
Après une intense recherche sur le net j'ai trouvé cela
Sur MSDN
http://support.microsoft.com/kb/306287
et plus original,mais pas idiot l'appel de JetComp en ligne de commande
http://stackoverflow.com/questions/6...ing-dao-and-jr
J'avoue que ce n'étaient pas les premieres réponses.
Je te laisse tester.
a+
soazig
Merci,
J'ai fini par trouve 3 reponses sur differents forums. Pratiquement elles se resument toutes a ce qui est propose par MSDN.
Voici les 3 reponses:
Reponse1
Reponse 2'Compact and repair DB. Save the repaired DB to the rout of G:.
jro.CompactDatabase("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=G:\E2E32\DataDrv32\Trans.MDB;" & "Jet OLEDBatabase Password=E2Eteam", _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=G:\Trans.MDB;" & "Jet OLEDBatabase Password=E2Eteam;Jet OLEDB:Engine Type=5")
Quote:
If this is omitted for the destination database, it will default to 5. The value for the destination database cannot be a version prior to that of the source database.
If you are using a Access 97 database.
Type=4
If you are using a Access 2002 database.
Type=5
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Reponse 3Is it possible to compact and repair a password protected mdb file(Access 2002) ?
Yes. Try the following code:
This is taken from the following Microsoft Knowledge base article: How To Compact Microsoft Access Database Through ADO. I recommend that you read this article as it tells you the references you will need to add to your Project so that this code will run.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 Dim JRO As JRO.JetEngine Dim strSourceName As String, strDestName As String Set JRO = New JRO.JetEngine strSourceName = "Provider=Microsoft.Jet.OLEDB.4.0;" _ & "Data Source=d:\compacttest\MyDB.mdb;" _ & "Jet OLEDB:System Database=d:\compacttest\MyWrkGrp.mdw;" _ & "User ID=YourUserName;" _ & "Password=YourPassword" strDestName = "Provider=Microsoft.Jet.OLEDB.4.0;" _ & "Data Source=d:\compacttest\CompactedName.mdb;" _ & "Jet OLEDB:Engine Type=5;" JRO.CompactDatabase strSourceName, strDestName
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1. Add a reference to "Microsoft Jet and Replication Objects 2.6 Library"
2. Check if the database is in use , display a warning.
3. Create a temporary folder and copy the DB
4. Create an object of JRO JetEngine and call the compact method , to compact the tempdb and replace at the original location. After compacting delete the temp folder along with its contents
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Merci bien d'avoir lancer ce sujet.
Ca m'as donné une idée pour ''améliorer'' une de mes applications et la solution en prime!
Reste plus qu'à tester la mise en pratique maintenant!
Vous avez un bloqueur de publicités installé.
Le Club Developpez.com n'affiche que des publicités IT, discrètes et non intrusives.
Afin que nous puissions continuer à vous fournir gratuitement du contenu de qualité, merci de nous soutenir en désactivant votre bloqueur de publicités sur Developpez.com.
Partager