Visualizzazione dei risultati da 1 a 9 su 9

Discussione: compattare db access

  1. #1
    Utente di HTML.it L'avatar di Umanista
    Registrato dal
    Jan 2002
    Messaggi
    1,022

    compattare db access

    Salve. Sapreste dirmi cortesemente come si compattano i db access in asp.net? Ho cercato un pò su diversi siti, ma trovo sempre e soltanto la soluzione in asp classico, con jro.


  2. #2
    girando qui e la ho trovato questo:
    codice:
    using System;
    namespace ConsoleApplication5
    {
        class Class1
        {
            static void Main(string[] args)
            {
                try
                {
                    JRO.JetEngine jro = new JRO.JetEngine();
    
                    string OldDb = "Provider=Microsoft.Jet.OLEDB.4.0;" +
                        "Data Source=<Path_to_your_database>\\nwind.mdb";
                    string NewDb = "Provider=Microsoft.Jet.OLEDB.4.0;" +
                        "Data Source=<Path_to_new_database>\\new_nwind.mdb";
    
                    jro.CompactDatabase(OldDb,NewDb);
                    Console.WriteLine("Finished Compacting Database");
                }
                catch(Exception e)
                {
                    Console.Write("The following error occurred:" + e.Message);
                }
            }
        }
    }

  3. #3
    in Vb.NET
    codice:
    Public Function compDatabase(ByVal dbName As String) As Boolean
       Dim daoVerweis As New DAO.DBEngine()
    
       Try
          'compress
          daoVerweis.CompactDatabase(dbName, getPathname(dbName) & "~tmp.mdb")
          daoVerweis = Nothing
    
          'delete old version and rename new version
          Kill(dbName)
          Rename(getPathname(dbName) & "~tmp.mdb", dbName) ' Rename file.
    
          'set return value
          compDatabase = True
       Catch ex As Exception
          MsgBox("Error while compressing database!" & vbCrLf & vbCrLf & _
    ex.Message, MsgBoxStyle.Exclamation + MsgBoxStyle.OKOnly, "Hinweis")
          compDatabase = False
       End Try
    End Function

  4. #4

  5. #5
    Utente di HTML.it L'avatar di Umanista
    Registrato dal
    Jan 2002
    Messaggi
    1,022
    Grazie infinite!

  6. #6
    ci sei riuscito? metteresti il codice online?

  7. #7
    Utente di HTML.it L'avatar di Umanista
    Registrato dal
    Jan 2002
    Messaggi
    1,022
    Purtroppo non ho ancora avuto il tempo di provare il codice.
    Ti faccio sapere al più presto.

  8. #8

  9. #9
    Utente di HTML.it L'avatar di Umanista
    Registrato dal
    Jan 2002
    Messaggi
    1,022
    Originariamente inviato da Daniele80
    ci sei riuscito? metteresti il codice online?
    Purtroppo non funziona.
    Faccio ancora qualche tentativo, altrimenti lascio la pagina in asp 3.0

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.