/// <summary> /// 更新一条数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public int update(Model.Evaluate_Classfication model) { string strSql = "UPDATE bl1_01_overall_simple SET Sglassid=@SYSTEM_GLASS_ID,Glassid=@GLASS_ID,Label=@Label WHERE Id=@Id"; MySqlParameter[] parameters = { new MySqlParameter("@SYSTEM_GLASS_ID", MySqlDbType.VarChar, 255), new MySqlParameter("@GLASS_ID", MySqlDbType.VarChar, 255), new MySqlParameter("@Label", MySqlDbType.VarChar, 255), new MySqlParameter("@Id", MySqlDbType.Int32) }; parameters[0].Value = model.Sglassid; parameters[1].Value = model.Glassid; parameters[2].Value = model.Label; parameters[3].Value = model.Id; object obj = Utility.MySqlHelper.ExecuteTxtScalar(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
public int add(Model.Evaluate_Classfication model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into bl1_01_overall_simple("); strSql.Append("Sglassid,Glassid,Label)"); strSql.Append(" values ("); strSql.Append("@SYSTEM_GLASS_ID,@GLASS_ID,@Label)"); strSql.Append(";select @@IDENTITY"); MySqlParameter[] parameters = { new MySqlParameter("@SYSTEM_GLASS_ID", MySqlDbType.VarChar, 255), new MySqlParameter("@GLASS_ID", MySqlDbType.VarChar, 255), new MySqlParameter("@Label", MySqlDbType.VarChar, 255), }; parameters[0].Value = model.Sglassid; parameters[1].Value = model.Glassid; parameters[2].Value = model.Label; object obj = Utility.MySqlHelper.ExecuteTxtScalar(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }