Ado
|
public class AdoDataConnection : IDisposable
The AdoDataConnection type exposes the following members.
Name | Description | |
---|---|---|
AdoDataConnection(String) | Creates and opens a new AdoDataConnection based on connection settings in configuration file. | |
AdoDataConnection(String, String) | Creates and opens a new AdoDataConnection from specified connectionString and dataProviderString. | |
AdoDataConnection(IDbConnection, Type, Boolean) | Creates a new AdoDataConnection from specified connection and adapterType. | |
AdoDataConnection(String, Type, Type) | Creates and opens a new AdoDataConnection from specified connectionString, connectionType, and adapterType. |
Name | Description | |
---|---|---|
AdapterType | Gets the type of data adapter for configured ADO.NET data source. | |
Connection | Gets an open IDbConnection to configured ADO.NET data source. | |
DatabaseType | Gets or sets the type of the database underlying the AdoDataConnection. | |
DefaultIsolationLevel | Gets the default IsolationLevel for the connected AdoDataConnection database type. | |
DefaultTimeout | Gets or sets default timeout for AdoDataConnection data operations. | |
IsJetEngine | Gets a value to indicate whether source database is Microsoft Access. | |
IsMySQL | Gets a value to indicate whether source database is MySQL. | |
IsOracle | Gets a value to indicate whether source database is Oracle. | |
IsPostgreSQL | Gets a value to indicate whether source database is PostgreSQL. | |
IsSqlite | Gets a value to indicate whether source database is SQLite. | |
IsSQLServer | Gets a value to indicate whether source database is Microsoft SQL Server. | |
UtcNow | Gets current UTC date-time in an implementation that is proper for the connected AdoDataConnection database type. |
Name | Description | |
---|---|---|
Bool | Returns proper Boolean implementation for connected AdoDataConnection database type. | |
Dispose | Releases all the resources used by the AdoDataConnection object. | |
Dispose(Boolean) | Releases the unmanaged resources used by the AdoDataConnection object and optionally releases the managed resources. | |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) | |
EscapeIdentifier | Escapes an identifier, e.g., a table or field name, using the common delimiter for the connected AdoDataConnection database type or the standard ANSI escaping delimiter, i.e., double-quotes, based on the useAnsiQuotes flag. | |
ExecuteNonQuery(String, Object) | Executes the SQL statement using Connection, and returns the number of rows affected. | |
ExecuteNonQuery(Int32, String, Object) | Executes the SQL statement using Connection, and returns the number of rows affected. | |
ExecuteReader(String, Object) | Executes the SQL statement using Connection, and builds a IDataReader. | |
ExecuteReader(Int32, String, Object) | Executes the SQL statement using Connection, and builds a IDataReader. | |
ExecuteReader(CommandBehavior, Int32, String, Object) | Executes the SQL statement using Connection, and builds a IDataReader. | |
ExecuteScalar(String, Object) | Executes the SQL statement using Connection, and returns the value in the first column of the first row in the result set. | |
ExecuteScalar(Int32, String, Object) | Executes the SQL statement using Connection, and returns the value in the first column of the first row in the result set. | |
ExecuteScalar(Type, String, Object) | Executes the SQL statement using Connection, and returns the value in the first column of the first row in the result set as type returnType. | |
ExecuteScalar(Type, Int32, String, Object) | Executes the SQL statement using Connection, and returns the value in the first column of the first row in the result set as type returnType. | |
ExecuteScalar(Type, Object, String, Object) | Executes the SQL statement using Connection, and returns the value in the first column of the first row in the result set as type returnType, substituting defaultValue if Value is retrieved. | |
ExecuteScalar(Type, Object, Int32, String, Object) | Executes the SQL statement using Connection, and returns the value in the first column of the first row in the result set as type returnType, substituting defaultValue if Value is retrieved. | |
ExecuteScalarT(String, Object) | Executes the SQL statement using Connection, and returns the value in the first column of the first row in the result set as type T. | |
ExecuteScalarT(Int32, String, Object) | Executes the SQL statement using Connection, and returns the value in the first column of the first row in the result set as type T. | |
ExecuteScalarT(T, String, Object) | Executes the SQL statement using Connection, and returns the value in the first column of the first row in the result set as type T, substituting defaultValue if Value is retrieved. | |
ExecuteScalarT(T, Int32, String, Object) | Executes the SQL statement using Connection, and returns the value in the first column of the first row in the result set as type T, substituting defaultValue if Value is retrieved. | |
ExecuteScript(String) | Executes the given SQL script using Connection. | |
ExecuteScript(TextReader) | Executes the given SQL script using Connection. | |
Finalize |
Releases the unmanaged resources before the AdoDataConnection object is reclaimed by GC.
(Overrides ObjectFinalize) | |
GetHashCode | Serves as the default hash function. (Inherited from Object) | |
GetType | Gets the Type of the current instance. (Inherited from Object) | |
Guid(Guid) | Returns proper Guid implementation for connected AdoDataConnection database type. | |
Guid(DataRow, String) | Retrieves Guid from a DataRow field based on database type. | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object) | |
ParameterizedQueryString | Creates a parameterized query string for the underlying database type based on the given format string and parameter names. | |
ReloadConfigurationSettings | Forces a reload of cached configuration connection settings. | |
RetrieveData(String, Object) | Executes the SQL statement using Connection, and returns the first DataTable of result set, if the result set contains at least one table. | |
RetrieveData(Int32, String, Object) | Executes the SQL statement using Connection, and returns the first DataTable of result set, if the result set contains at least one table. | |
RetrieveDataSet(String, Object) | Executes the SQL statement using Connection, and returns the DataSet that may contain multiple tables, depending on the SQL statement. | |
RetrieveDataSet(Int32, String, Object) | Executes the SQL statement using Connection, and returns the DataSet that may contain multiple tables, depending on the SQL statement. | |
RetrieveRow(String, Object) | Executes the SQL statement using Connection, and returns the first DataRow in the result set. | |
RetrieveRow(Int32, String, Object) | Executes the SQL statement using Connection, and returns the first DataRow in the result set. | |
ToDataProviderString | Generates a data provider string for the given connection type and adapter type. | |
ToString | Returns a string that represents the current object. (Inherited from Object) | |
TryRetrieveRow(String, DataRow, Object) | Tries to retrieve the first DataRow in the result set of the SQL statement using Connection. | |
TryRetrieveRow(Int32, String, DataRow, Object) | Tries to retrieve the first DataRow in the result set of the SQL statement using Connection. |
Name | Description | |
---|---|---|
GetEnumValueOrDefault |
Gets the enumeration constant for value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions) | |
GetEnumValueOrDefaultT |
Gets the enumeration constant for this value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions) |
Database type | Example connection string / data provider string |
---|---|
SQL Server |
ConnectionString = "Data Source=serverName; Initial Catalog=databaseName; User ID=userName; Password=password" DataProviderString = "AssemblyName={System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089}; ConnectionType=System.Data.SqlClient.SqlConnection; AdapterType=System.Data.SqlClient.SqlDataAdapter" |
Oracle |
ConnectionString = "Data Source=tnsName; User ID=schemaUserName; Password=schemaPassword" DataProviderString = "AssemblyName={Oracle.DataAccess, Version=2.112.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342}; ConnectionType=Oracle.DataAccess.Client.OracleConnection; AdapterType=Oracle.DataAccess.Client.OracleDataAdapter" |
MySQL |
ConnectionString = "Server=serverName; Database=databaseName; Uid=root; Pwd=password; allow user variables = true" DataProviderString = "AssemblyName={MySql.Data, Version=6.3.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d}; ConnectionType=MySql.Data.MySqlClient.MySqlConnection; AdapterType=MySql.Data.MySqlClient.MySqlDataAdapter" |
SQLite |
ConnectionString = "Data Source=databaseName.db; Version=3; Foreign Keys=True; FailIfMissing=True" DataProviderString = "AssemblyName={System.Data.SQLite, Version=1.0.109.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139}; ConnectionType=System.Data.SQLite.SQLiteConnection; AdapterType=System.Data.SQLite.SQLiteDataAdapter" |
SQLite (Mono native driver) |
ConnectionString = "Data Source=./databaseName.db; Version=3; Foreign Keys=True; FailIfMissing=True" DataProviderString = "AssemblyName={Mono.Data.Sqlite, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756}; ConnectionType=Mono.Data.Sqlite.SqliteConnection; AdapterType=Mono.Data.Sqlite.SqliteDataAdapter" |
Access / OleDB |
ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=databaseName.mdb" DataProviderString = "AssemblyName={System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089}; ConnectionType=System.Data.OleDb.OleDbConnection; AdapterType=System.Data.OleDb.OleDbDataAdapter" |
ODBC Connection |
ConnectionString = "Driver={SQL Server Native Client 10.0}; Server=serverName; Database=databaseName; Uid=userName; Pwd=password" DataProviderString = "AssemblyName={System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089}; ConnectionType=System.Data.Odbc.OdbcConnection; AdapterType=System.Data.Odbc.OdbcDataAdapter" |
<?xml version="1.0" encoding="utf-8"?> <configuration> <configSections> <section name="categorizedSettings" type="GSF.Configuration.CategorizedSettingsSection, GSF.Core" /> </configSections> <categorizedSettings> <systemSettings> <add name="ConnectionString" value="Data Source=localhost\SQLEXPRESS; Initial Catalog=MyDatabase; Integrated Security=SSPI" description="ADO database connection string" encrypted="false" /> <add name="DataProviderString" value="AssemblyName={System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089}; ConnectionType=System.Data.SqlClient.SqlConnection; AdapterType=System.Data.SqlClient.SqlDataAdapter" description="ADO database provider string" encrypted="false" /> </systemSettings> </categorizedSettings> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> </startup> </configuration>