C# Class EmTrac2SF.DBAccess

Class with static methods to handle all database interaction
Inheritance: IDisposable
ファイルを表示 Open project: fmendes/SalesForceCSharpAPI

Public Properties

Property Type Description
Cache System.Web.Caching.Cache
ErrorLabel System.Web.UI.WebControls.Label
ErrorMessage string
MainDB string
iConnectionRetries int
objConn System.Data.SqlClient.SqlConnection
objIsolationLevel IsolationLevel
objLastUpdateRow System.Data.DataRow
objSync object
strLogFlag string
strPath string

Public Methods

Method Description
Dispose ( ) : void
GetConnection ( ) : SqlConnection

Creates a SqlConnection using the Default Connection String

GetConnection ( string strName ) : SqlConnection

Creates a SqlConnection using the given Connection String

GetConnectionRef ( string strName ) : SqlConnection
GetConnectionString ( ) : string
GetConnectionString ( string strName ) : string
GetDataSetFromSQL ( string strSQL ) : DataSet
GetDataTableFromSQL ( string strSQL ) : DataTable
GetDataTableFromSQLFile ( string strFileName, string strPrependScript = null, string strCondition = null ) : DataTable
GetIntegerFromSQL ( string strSQL ) : int
GetSQLFromFile ( string strFile ) : string
GetSqlDataReaderFromSQL ( string strSQL ) : System.Data.SqlClient.SqlDataReader
GetStringFromSQL ( string strSQL ) : string
ReplaceApostrophes ( string strValue ) : string
ReportError ( string strErrorMsg ) : void
RunSQL ( string strSQL ) : int
SetConnectionRef ( string strName, SqlConnection sc ) : void
StringFormat ( string strFormat ) : string

Does the same thing as 'string.Format' but duplicating single quotes so it will be accepted in the SQL statement context. Example: O'Hare will become O''Hare

TryConnect ( ) : bool

Opens the connection to the database

TryConnect ( string strName ) : bool

Opens the connection to the database using the given Connection String

UpdateAdapter ( DataSet ds, SqlDataAdapter objSqlAdapter, SqlCommand objComm ) : void
UpdateAdapterRowCheck ( DataSet ds, SqlDataAdapter objSqlAdapter, SqlCommand objComm ) : void
objSqlAdapter_RowUpdated ( object sender, System.Data.SqlClient.SqlRowUpdatedEventArgs e ) : void
objSqlAdapter_RowUpdating ( object sender, System.Data.SqlClient.SqlRowUpdatingEventArgs e ) : void

Protected Methods

Method Description
Dispose ( bool bNative = true ) : void

Private Methods

Method Description
CommitAndDisconnect ( SqlTransaction &objTrans ) : void
RollbackAndReportError ( SqlTransaction &objTrans, Exception excpt ) : void

Method Details

Dispose() public method

public Dispose ( ) : void
return void

Dispose() protected method

protected Dispose ( bool bNative = true ) : void
bNative bool
return void

GetConnection() public method

Creates a SqlConnection using the Default Connection String
public GetConnection ( ) : SqlConnection
return System.Data.SqlClient.SqlConnection

GetConnection() public method

Creates a SqlConnection using the given Connection String
public GetConnection ( string strName ) : SqlConnection
strName string A connection string
return System.Data.SqlClient.SqlConnection

GetConnectionRef() public method

public GetConnectionRef ( string strName ) : SqlConnection
strName string
return System.Data.SqlClient.SqlConnection

GetConnectionString() public method

public GetConnectionString ( ) : string
return string

GetConnectionString() public static method

public static GetConnectionString ( string strName ) : string
strName string
return string

GetDataSetFromSQL() public method

public GetDataSetFromSQL ( string strSQL ) : DataSet
strSQL string
return System.Data.DataSet

GetDataTableFromSQL() public method

public GetDataTableFromSQL ( string strSQL ) : DataTable
strSQL string
return System.Data.DataTable

GetDataTableFromSQLFile() public method

public GetDataTableFromSQLFile ( string strFileName, string strPrependScript = null, string strCondition = null ) : DataTable
strFileName string
strPrependScript string
strCondition string
return System.Data.DataTable

GetIntegerFromSQL() public method

public GetIntegerFromSQL ( string strSQL ) : int
strSQL string
return int

GetSQLFromFile() public method

public GetSQLFromFile ( string strFile ) : string
strFile string
return string

GetSqlDataReaderFromSQL() public method

public GetSqlDataReaderFromSQL ( string strSQL ) : System.Data.SqlClient.SqlDataReader
strSQL string
return System.Data.SqlClient.SqlDataReader

GetStringFromSQL() public method

public GetStringFromSQL ( string strSQL ) : string
strSQL string
return string

ReplaceApostrophes() public static method

public static ReplaceApostrophes ( string strValue ) : string
strValue string
return string

ReportError() public method

public ReportError ( string strErrorMsg ) : void
strErrorMsg string
return void

RunSQL() public method

public RunSQL ( string strSQL ) : int
strSQL string
return int

SetConnectionRef() public method

public SetConnectionRef ( string strName, SqlConnection sc ) : void
strName string
sc System.Data.SqlClient.SqlConnection
return void

StringFormat() public static method

Does the same thing as 'string.Format' but duplicating single quotes so it will be accepted in the SQL statement context. Example: O'Hare will become O''Hare
public static StringFormat ( string strFormat ) : string
strFormat string String containing zero or more format items.
return string

TryConnect() public method

Opens the connection to the database
public TryConnect ( ) : bool
return bool

TryConnect() public method

Opens the connection to the database using the given Connection String
public TryConnect ( string strName ) : bool
strName string A Connection String
return bool

UpdateAdapter() public method

public UpdateAdapter ( DataSet ds, SqlDataAdapter objSqlAdapter, SqlCommand objComm ) : void
ds System.Data.DataSet
objSqlAdapter System.Data.SqlClient.SqlDataAdapter
objComm System.Data.SqlClient.SqlCommand
return void

UpdateAdapterRowCheck() public method

public UpdateAdapterRowCheck ( DataSet ds, SqlDataAdapter objSqlAdapter, SqlCommand objComm ) : void
ds System.Data.DataSet
objSqlAdapter System.Data.SqlClient.SqlDataAdapter
objComm System.Data.SqlClient.SqlCommand
return void

objSqlAdapter_RowUpdated() public method

public objSqlAdapter_RowUpdated ( object sender, System.Data.SqlClient.SqlRowUpdatedEventArgs e ) : void
sender object
e System.Data.SqlClient.SqlRowUpdatedEventArgs
return void

objSqlAdapter_RowUpdating() public method

public objSqlAdapter_RowUpdating ( object sender, System.Data.SqlClient.SqlRowUpdatingEventArgs e ) : void
sender object
e System.Data.SqlClient.SqlRowUpdatingEventArgs
return void

Property Details

Cache public_oe property

public Cache,System.Web.Caching Cache
return System.Web.Caching.Cache

ErrorLabel public_oe property

public Label,System.Web.UI.WebControls ErrorLabel
return System.Web.UI.WebControls.Label

ErrorMessage public_oe property

public string ErrorMessage
return string

MainDB public_oe property

public string MainDB
return string

iConnectionRetries public_oe static_oe property

public static int iConnectionRetries
return int

objConn public_oe property

public SqlConnection,System.Data.SqlClient objConn
return System.Data.SqlClient.SqlConnection

objIsolationLevel public_oe property

public IsolationLevel objIsolationLevel
return IsolationLevel

objLastUpdateRow public_oe property

public DataRow,System.Data objLastUpdateRow
return System.Data.DataRow

objSync public_oe static_oe property

public static object objSync
return object

strLogFlag public_oe property

public string strLogFlag
return string

strPath public_oe property

public string strPath
return string