示例#1
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));
        }
示例#2
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));
        }
示例#3
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)));
 }
示例#4
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)));
 }