private void m_Delete_Click(object sender, EventArgs e) { string modelName = m_VehModel.SelectedItem.ToString(); if (modelName == "限值a" || modelName == "限值b") { MessageBox.Show("无法删除"); return; } BLL.COSTUME_MODEL_LIMIT_BLL records = new BLL.COSTUME_MODEL_LIMIT_BLL(); string cmdText = "EXECUTE SP_DELETE_COSTUME_MODEL_LIMIT @MODEL_NAME"; SqlParameter para = new SqlParameter("MODEL_NAME", modelName); string result = ""; using (SqlConnection connection = new SqlConnection(dbConfig.g_strConnectionStringSqlClient1)) { connection.Open(); SqlCommand sqlCmd = new SqlCommand(cmdText, connection); sqlCmd.Parameters.Add(para); int r = sqlCmd.ExecuteNonQuery(); m_VehModel.Items.Remove(modelName); MessageBox.Show("删除成功"); sqlCmd.Dispose(); } }
private bool InsertCostumeLimitTable(COSTUME_MODEL_LIMIT entity) { if (Exist(entity.MODEL_NAME)) { MessageBox.Show("该车型已存在自定义限值 不用添加"); return(false); } else { BLL.COSTUME_MODEL_LIMIT_BLL bll = new BLL.COSTUME_MODEL_LIMIT_BLL(); return(bll.Insert(entity)); } }