Beispiel #1
0
        /// <summary>
        /// Execute the query with parameters, specifying the connection string 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>
        /// <param name="connStr">Connection string to use</param>
        /// <returns>The result of the stored procedure's SELECT statements</returns>
        public static DataSet getDataSetFromQuery(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._getDataSet(cmd));
        }
Beispiel #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 statements</returns>
        public static DataSet getDataSet(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._getDataSet(cmd));
        }
Beispiel #3
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 statements</returns>
 public static DataSet getDataSetFromQuery(string query, string connStr)
 {
     return(ConnectionTools._getDataSet(ConnectionTools._createConnection(query, CommandType.Text, connStr)));
 }
Beispiel #4
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 statements</returns>
 public static DataSet getDataSet(string storedProcedure, string connStr)
 {
     return(ConnectionTools._getDataSet(ConnectionTools._createConnection(storedProcedure, CommandType.StoredProcedure, connStr)));
 }