Пример #1
0
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <param name="su">模型类</param>
        /// <returns>受影响的行数</returns>
        public int Add(system_users su)
        {
            string sql = "INSERT INTO system_users(ucode,upwd) VALUES(@ucode,@upwd);";

            SqlParameter[] param =
            {
                new SqlParameter("@ucode", SqlDbType.VarChar, 10)
                {
                    Value = su.ucode
                },
                new SqlParameter("@upwd",  SqlDbType.VarChar, 10)
                {
                    Value = su.upwd
                }
            };
            return(ADOTools.ExecuteNonQuery(sql, param));
        }
Пример #2
0
        /// <summary>
        /// 更新数据
        /// </summary>
        /// <param name="su">模型类</param>
        /// <returns>受影响的行数</returns>
        public int Update(system_users su)
        {
            string sql = "UPDATE system_users SET ucode = @ucode,upwd = @upwd WHERE uid = @uid;";

            SqlParameter[] param =
            {
                new SqlParameter("@uid",   SqlDbType.Int)
                {
                    Value = su.uid
                },
                new SqlParameter("@ucode", SqlDbType.VarChar, 10)
                {
                    Value = su.ucode
                },
                new SqlParameter("@upwd",  SqlDbType.VarChar, 10)
                {
                    Value = su.upwd
                }
            };
            return(ADOTools.ExecuteNonQuery(sql, param));
        }