コード例 #1
0
 /// <summary>
 /// Execute a SqlCommand (that returns a 1x1 resultset and takes no parameters) against the database specified
 /// </summary>
 /// <param name="connSettings">A DataConnectionSettings object defining the connection parameters</param>
 /// <param name="commandType">The CommandType (stored procedure, text, etc.)</param>
 /// <param name="commandText">The stored procedure name or T-SQL command</param>
 /// <returns>An object containing the value in the 1x1 resultset generated by the command</returns>
 public static object ExecuteScalar(Config.Connection connSettings, CommandType commandType, string commandText)
 {
     return(ExecuteScalar(connSettings.ConnectionString, commandType, commandText));
 }
コード例 #2
0
 /// <summary>
 /// Execute a SqlCommand (that returns a 1x1 resultset) against the database specified
 /// </summary>
 /// <param name="connSettings">A DataConnectionSettings object defining the connection parameters</param>
 /// <param name="commandType">The CommandType (stored procedure, text, etc.)</param>
 /// <param name="commandText">The stored procedure name or T-SQL command</param>
 /// <param name="commandParameters">A list of SqlParamters used to execute the command</param>
 /// <returns>An object containing the value in the 1x1 resultset generated by the command</returns>
 public static object ExecuteScalar(Config.Connection connSettings, CommandType commandType, string commandText, params SqlParameter[] commandParameters)
 {
     return(ExecuteScalar(connSettings.ConnectionString, commandType, commandText, commandParameters));
 }
コード例 #3
0
 /// <summary>
 /// Execute a SqlCommand (that returns a resultset and takes no parameters) against the database specified
 /// </summary>
 /// <param name="connSettings"></param>
 /// <param name="commandType">The CommandType (stored procedure, text, etc.)</param>
 /// <param name="commandText">The stored procedure name or T-SQL command</param>
 /// <returns>A dataset containing the resultset generated by the command</returns>
 public static DataSet ExecuteDataset(Config.Connection connSettings, CommandType commandType, string commandText)
 {
     return(ExecuteDataset(connSettings.ConnectionString, commandType, commandText));
 }
コード例 #4
0
 /// <summary>
 /// Execute a SqlCommand (that returns a resultset) against the database specified in
 /// the DataConnectionSettings object.
 /// </summary>
 /// <param name="connSettings"></param>
 /// <param name="commandType">The CommandType (stored procedure, text, etc.)</param>
 /// <param name="commandText">The stored procedure name or T-SQL command</param>
 /// <param name="commandParameters">A list of SqlParamters used to execute the command</param>
 /// <returns>A dataset containing the resultset generated by the command</returns>
 public static DataSet ExecuteDataset(Config.Connection connSettings, CommandType commandType, string commandText, params SqlParameter[] commandParameters)
 {
     return(ExecuteDataset(connSettings.ConnectionString, commandType, commandText, commandParameters));
 }
コード例 #5
0
 /// <summary>
 /// Create and prepare a SqlCommand, and call ExecuteReader with the appropriate CommandBehavior.
 /// </summary>
 /// <param name="connSettings">A DataConnectionSettings object defining the connection parameters</param>
 /// <param name="commandType">The CommandType (stored procedure, text, etc.)</param>
 /// <param name="commandText">The stored procedure name or T-SQL command</param>
 /// <param name="commandParameters">An array of SqlParameters to be associated with the command or 'null' if no parameters are required</param>
 /// <returns>SqlDataReader containing the results of the command</returns>
 public static SqlDataReader ExecuteReader(Config.Connection connSettings, CommandType commandType, string commandText, params SqlParameter[] commandParameters)
 {
     return(ExecuteReader(connSettings.ConnectionString, commandType, commandText, commandParameters));
 }
コード例 #6
0
 /// <summary>
 /// Create and prepare a SqlCommand, and call ExecuteReader with the appropriate CommandBehavior.
 /// </summary>
 /// <param name="connSettings">A DataConnectionSettings object defining the connection parameters</param>
 /// <param name="commandType">The CommandType (stored procedure, text, etc.)</param>
 /// <param name="commandText">The stored procedure name or T-SQL command</param>
 /// <returns>SqlDataReader containing the results of the command</returns>
 public static SqlDataReader ExecuteReader(Config.Connection connSettings, CommandType commandType, string commandText)
 {
     return(ExecuteReader(connSettings.ConnectionString, commandType, commandText));
 }
コード例 #7
0
 /// <summary>
 /// Execute a SqlCommand (that returns no resultset) against the specified database
 /// </summary>
 /// <param name="connSettings">A DataConnectionSetting object defining the db connection to use</param>
 /// <param name="commandType">The CommandType (stored procedure, text, etc.)</param>
 /// <param name="commandText">The stored procedure name or T-SQL command</param>
 /// <param name="commandParameters">An array of SqlParamters used to execute the command</param>
 /// <returns>An int representing the number of rows affected by the command</returns>
 public static int ExecuteNonQuery(Config.Connection connSettings, CommandType commandType, string commandText, params SqlParameter[] commandParameters)
 {
     return(ExecuteNonQuery(connSettings.ConnectionString, commandType, commandText, commandParameters));
 }
コード例 #8
0
 /// <summary>
 /// Execute a SqlCommand (that returns no resultset and takes no parameters) against the specified database
 /// </summary>
 /// <param name="connSettings"></param>
 /// <param name="commandType">The CommandType (stored procedure, text, etc.)</param>
 /// <param name="commandText">The stored procedure name or T-SQL command</param>
 /// <returns>An int representing the number of rows affected by the command</returns>
 public static int ExecuteNonQuery(Config.Connection connSettings, CommandType commandType, string commandText)
 {
     return(ExecuteNonQuery(connSettings.ConnectionString, commandType, commandText));
 }
コード例 #9
0
 /// <summary>
 /// Begins a Transaction on a new connection to the specified database.
 /// </summary>
 /// <param name="connSettings">The database settings object to use</param>
 /// <returns>A new open SqlTransaction</returns>
 public static SqlTransaction GetNewTransaction(Config.Connection connSettings)
 {
     return(GetNewTransaction(connSettings.ConnectionString));
 }