📄 connectionobject.cs
字号:
//------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Runtime Version: 1.1.4322.2032
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
//------------------------------------------------------------------------------
using System;
using System.Data;
using System.Data.Common;
using System.Data.OleDb;
/// <summary>
/// This class handles the connection to a DataBase
/// </summary>
/// <remarks>
/// created by - Forstmeier Peter
/// created on - 17.10.2005 22:59:39
/// </remarks>
namespace SharpReportCore {
public class ConnectionObject : object,IDisposable {
IDbConnection connection;
OleDbConnectionStringBuilder oleDbConnectionStringBuilder;
string connectionString;
public ConnectionObject(string connectionString) {
if (String.IsNullOrEmpty(connectionString)) {
throw new ArgumentNullException("connectionString");
}
this.connectionString = connectionString;
this.connection = new OleDbConnection (this.connectionString);
}
public ConnectionObject( OleDbConnectionStringBuilder oleDbConnectionStringBuilder){
this.oleDbConnectionStringBuilder = oleDbConnectionStringBuilder;
try {
this.connection = new OleDbConnection (this.oleDbConnectionStringBuilder.ConnectionString);
} catch (Exception ) {
throw;
}
}
public ConnectionObject(IDbConnection connection){
this.connection = connection;
this.connectionString = this.connection.ConnectionString;
}
public IDbConnection Connection {
get {
return connection;
}
}
#region IDisposeable
public void Dispose () {
Dispose(true);
GC.SuppressFinalize(this);
}
~ConnectionObject(){
Dispose(false);
}
protected virtual void Dispose(bool disposing) {
try{
if (disposing){
if (this.connection != null){
if (this.connection.State == ConnectionState.Open) {
this.connection.Close();
}
this.connection.Dispose();
}
}
}
finally{
connection = null;
}
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -