DataContext.DatabaseExists Metodo
Definizione
Determina se il database associato può essere aperto.Determines whether the associated database can be opened.
public:
bool DatabaseExists();
public bool DatabaseExists ();
member this.DatabaseExists : unit -> bool
Public Function DatabaseExists () As Boolean
Restituisce
true
se il database specificato può essere aperto; in caso contrario, false
.true
if the specified database can be opened; otherwise, false
.
Esempi
Nell'esempio seguente viene utilizzato questo metodo per determinare se un database esiste già.The following example uses this method to determine whether a database already exists.
if (!db.DatabaseExists())
db.CreateDatabase();
// …
db.DeleteDatabase();
If Not db.DatabaseExists Then
db.CreateDatabase()
End If
' ...
db.DeleteDatabase()
Commenti
Questo metodo utilizza la connessione nella Connection proprietà per tentare di aprire il database associato.This method uses the connection in the Connection property to attempt to open the associated database.