public int delete(message mes) { StringBuilder sql = new StringBuilder(); sql.Append("delete from message where _id=@id"); MySqlParameter[] pra = { new MySqlParameter("@id",MySqlDbType.Int32) }; pra[0].Value = mes.id; return DBHelperMySQL.ExecuteSql(sql.ToString(), pra); }
public string insert(string title, string content) { Model.message mes = new Model.message(); mes.title = title; mes.content = content; mes.ip = Request.UserHostAddress; BLL.BLLmessage bllmessage = new BLL.BLLmessage(); int result = bllmessage.post(mes); if (result > 0) { return("1"); } else { return("0"); } }
public string insert(string title,string content) { Model.message mes = new Model.message(); mes.title = title; mes.content = content; mes.ip = Request.UserHostAddress; BLL.BLLmessage bllmessage = new BLL.BLLmessage(); int result = bllmessage.post(mes); if (result > 0) { return "1"; } else { return "0"; } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.message model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Model.message model) { return(dal.Add(model)); }
public int post(message mes) { StringBuilder sql = new StringBuilder(); sql.Append("insert into message(_title,_content,_ip) values(@title,@content,@ip)"); MySqlParameter[] pra = { new MySqlParameter("@title",MySqlDbType.VarChar,50), new MySqlParameter("@content",MySqlDbType.VarChar,250), new MySqlParameter("@ip",MySqlDbType.VarChar,50) }; pra[0].Value = mes.title; pra[1].Value = mes.content; pra[2].Value = mes.ip; return DBHelperMySQL.ExecuteSql(sql.ToString(), pra); }
public int update(message mes) { StringBuilder sql = new StringBuilder(); sql.Append("update message set _title=@title,_content=@content,_ip=@ip where _id=@id"); MySqlParameter[] pra = { new MySqlParameter("@title",MySqlDbType.VarChar,50), new MySqlParameter("@content",MySqlDbType.VarChar,250), new MySqlParameter("@ip",MySqlDbType.VarChar,50), new MySqlParameter("@id",MySqlDbType.Int32) }; pra[0].Value = mes.title; pra[1].Value = mes.content; pra[2].Value = mes.ip; pra[3].Value = mes.id; return DBHelperMySQL.ExecuteSql(sql.ToString(), pra); }
public int reply(message mes) { StringBuilder sql = new StringBuilder(); sql.Append("update message set _reply=@reply,_state=@state where _id=@id"); MySqlParameter[] pra = { new MySqlParameter("@reply",MySqlDbType.VarChar,200), new MySqlParameter("@state",MySqlDbType.Int32), new MySqlParameter("@id",MySqlDbType.Int32) }; pra[0].Value = mes.reply; pra[1].Value = mes.state; pra[2].Value = mes.id; return DBHelperMySQL.ExecuteSql(sql.ToString(), pra); }