Exemplo n.º 1
0
 /// <summary>
 /// 插入信息
 /// </summary>
 public static void Insert(this MySqlConnection conn, ZinSQL sql, List <MySqlParameter> paramList)
 {
     conn.ExecuteNonQuery(string.Format("insert into {0}({1}) values({2})", sql.TableName, sql.GetFields(), sql.GetValues()), paramList);
 }
Exemplo n.º 2
0
        /// <summary>
        /// 判断是否存在
        /// </summary>
        public static bool Has(this MySqlConnection conn, ZinSQL sql)
        {
            var fields = sql.GetFields();
            var count  = conn.ExecuteScalar(string.Format("select COUNT({1}) from {0} where {2} = {3}", sql.TableName, fields, fields, sql.GetValues()));

            return(Convert.ToInt32(count) > 0);
        }