Database Database Database Class

Definition

Provides methods and properties that are used to access and manage data that is stored in a database.

public class Database : IDisposable
type Database = class
    interface IDisposable
Public Class Database
Implements IDisposable
Inheritance
DatabaseDatabaseDatabase
Implements

Properties

Connection Connection Connection

Gets the current connection to a database.

Methods

Close() Close() Close()

Closes an open database.

Dispose() Dispose() Dispose()

Releases all resources used by a Database instance.

Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

Releases the unmanaged resources used by a Database instance and optionally releases the managed resources.

Execute(String, Object[]) Execute(String, Object[]) Execute(String, Object[])

Executes a non-query SQL statement.

GetLastInsertId() GetLastInsertId() GetLastInsertId()

Returns the identity column of the most recently inserted row.

Open(String) Open(String) Open(String)

Opens a connection to a database using the specified file name or using the named connection string.

OpenConnectionString(String) OpenConnectionString(String) OpenConnectionString(String)

Opens a connection to a database using the specified connection string.

OpenConnectionString(String, String) OpenConnectionString(String, String) OpenConnectionString(String, String)

Opens a connection to a database using a connection string and the specified provider.

Query(String, Object[]) Query(String, Object[]) Query(String, Object[])

Executes a SQL query that returns a list of rows as the result.

QuerySingle(String, Object[]) QuerySingle(String, Object[]) QuerySingle(String, Object[])

Executes a SQL query that returns a single row as the result.

QueryValue(String, Object[]) QueryValue(String, Object[]) QueryValue(String, Object[])

Executes a SQL query that returns a single scalar value as the result.

Events

ConnectionOpened ConnectionOpened ConnectionOpened

Occurs when a new database connection is opened by a Database instance.

Applies to