示例#1
0
        /// <summary>
        /// Convenience method for building a command
        /// </summary>
        /// <param name="sql">The SQL to execute with param names as @0, @1, @2 etc</param>
        /// <param name="args">The parameters to match the @ notations</param>
        /// <returns></returns>
        public NpgsqlCommand BuildCommand(string sql, params object[] args)
        {
            var cmd = new NpgsqlCommand(sql);

            cmd.AddParams(args);
            return(cmd);
        }
示例#2
0
        public static IDbCommand ToCmd(this string sql, params IDbDataParameter[] commandParameters)
        {
            IDbCommand cmd = new NpgsqlCommand(sql);

            cmd.AddParams(commandParameters);
            return(cmd);
        }