Esempio n. 1
0
        /// <summary>
        /// Execute the query with parameters and getting the result set
        /// </summary>
        /// <param name="query">Query to execute</param>
        /// <param name="parameters">The stored procedure's params, the dictionary's Key and the stored procedure's parameter must have the same name</param>
        /// <returns>The result of the stored procedure's SELECT statement</returns>
        public static DataTable getDataTableFromQuery(string query, Dictionary <string, object> parameters)
        {
            var cmd = ConnectionTools._createConnection(query, CommandType.Text);

            if (parameters != null)
            {
                cmd = AddParameters(cmd, parameters);
            }
            return(ConnectionTools._getDataTable(cmd));
        }
Esempio n. 2
0
        /// <summary>
        /// Call a Stored procedure with parameters, specifying the connection string and getting the result set
        /// </summary>
        /// <param name="storedProcedure">Stored procedure name</param>
        /// <param name="parameters">The stored procedure's params, the dictionary's Key and the stored procedure's parameter must have the same name</param>
        /// <param name="connStr">Connection string to use</param>
        /// <returns>The result of the stored procedure's SELECT statement</returns>
        public static DataTable getDataTable(string storedProcedure, Dictionary <string, object> parameters, string connStr)
        {
            var cmd = ConnectionTools._createConnection(storedProcedure, CommandType.StoredProcedure, connStr);

            if (parameters != null)
            {
                cmd = AddParameters(cmd, parameters);
            }
            return(ConnectionTools._getDataTable(cmd));
        }
Esempio n. 3
0
        /// <summary>
        /// Call a Stored procedure with parameters specifying the connection string to use
        /// </summary>
        /// <param name="storedProcedure">Stored procedure name</param>
        /// <param name="parameters">The stored procedure's params, the dictionary's Key and the stored procedure's parameter must have the same name</param>
        /// <param name="connStr">Connection string to use</param>
        /// <returns>True if one or more rows were affected, other way False </returns>
        public static bool executeNonQuery(string storedProcedure, Dictionary <string, object> parameters, string connStr)
        {
            var cmd = ConnectionTools._createConnection(storedProcedure, CommandType.StoredProcedure, connStr);

            if (parameters != null)
            {
                cmd = AddParameters(cmd, parameters);
            }
            return(ConnectionTools._executeNonQuery(cmd));
        }
Esempio n. 4
0
        /// <summary>
        /// Execute the query with parameters specifying the connection string to use
        /// </summary>
        /// <param name="query">Query to execute</param>
        /// <param name="parameters">The stored procedure's params, the dictionary's Key and the stored procedure's parameter must have the same name</param>
        /// <param name="connStr">Connection string to use</param>
        /// <returns>True if one or more rows were affected, other way False </returns>
        public static bool executeNonQueryFromQuery(string query, Dictionary <string, object> parameters, string connStr)
        {
            var cmd = ConnectionTools._createConnection(query, CommandType.Text, connStr);

            if (parameters != null)
            {
                cmd = AddParameters(cmd, parameters);
            }
            return(ConnectionTools._executeNonQuery(cmd));
        }
Esempio n. 5
0
 /// <summary>
 /// Execute the query with no parameters, specifying the connection string and getting the result set
 /// </summary>
 /// <param name="query">Query to execute</param>
 /// <param name="connStr">Connection string to use</param>
 /// <returns>The result of the stored procedure's SELECT statement</returns>
 public static DataTable getDataTableFromQuery(string query, string connStr)
 {
     return(ConnectionTools._getDataTable(ConnectionTools._createConnection(query, CommandType.Text, connStr)));
 }
Esempio n. 6
0
 /// <summary>
 /// Execute the query with no parameters specifying the connection string to use
 /// </summary>
 /// <param name="query">Query to execute</param>
 /// <param name="connStr">Connection string to use</param>
 /// <returns>True if one or more rows were affected, other way False </returns>
 public static bool executeNonQueryFromQuery(string query, string connStr)
 {
     return(ConnectionTools._executeNonQuery(ConnectionTools._createConnection(query, CommandType.Text, connStr)));
 }
Esempio n. 7
0
 /// <summary>
 /// Call a Stored procedure with no parameters, specifying the connection string and getting the result set
 /// </summary>
 /// <param name="storedProcedure">Stored procedure name</param>
 /// <param name="connStr">Connection string to use</param>
 /// <returns>The result of the stored procedure's SELECT statement</returns>
 public static DataTable getDataTable(string storedProcedure, string connStr)
 {
     return(ConnectionTools._getDataTable(ConnectionTools._createConnection(storedProcedure, CommandType.StoredProcedure, connStr)));
 }
Esempio n. 8
0
 /// <summary>
 /// Call a Stored procedure with no parameters, specifying the connection string to use
 /// </summary>
 /// <param name="storedProcedure">Stored procedure name</param>
 /// <param name="connStr">Connection string to use</param>
 /// <returns>True if one or more rows were affected, other way False </returns>
 public static bool executeNonQuery(string storedProcedure, string connStr)
 {
     return(ConnectionTools._executeNonQuery(ConnectionTools._createConnection(storedProcedure, CommandType.StoredProcedure, connStr)));
 }
Esempio n. 9
0
 /// <summary>
 /// Execute the query with no parameters and getting the result set
 /// </summary>
 /// <param name="query">Query to execute</param>
 /// <returns>The result of the stored procedure's SELECT statements</returns>
 public static DataSet getDataSetFromQuery(string query)
 {
     return(ConnectionTools._getDataSet(ConnectionTools._createConnection(query, CommandType.Text)));
 }
Esempio n. 10
0
 /// <summary>
 /// Call a Stored procedure with no parameters and getting the result set
 /// </summary>
 /// <param name="storedProcedure">Stored procedure name</param>
 /// <returns>The result of the stored procedure's SELECT statements</returns>
 public static DataSet getDataSet(string storedProcedure)
 {
     return(ConnectionTools._getDataSet(ConnectionTools._createConnection(storedProcedure, CommandType.StoredProcedure)));
 }