private void bntOK_Click(object sender, EventArgs e) { tbProPathClass tbCalss = new tbProPathClass(); tbProPathMenthod tbMenthod = new tbProPathMenthod(); if (textBox1.Text == "") { MessageBox.Show("名称:不能为空!", "提示"); } tbCalss.ProID = tbMenthod.tbProPathID(); tbCalss.ProName = textBox1.Text; tbCalss.ProPath = "0"; int intResult = tbMenthod.tbProPathMenthodAdd(tbCalss); if (intResult == 1) { MessageBox.Show("添加成功!"); frmtbProPath frm = (frmtbProPath)this.Owner; tbMenthod.filltbProPath(frm.treeView1, frm.imageList1); this.Close(); } else { MessageBox.Show("添加失败!"); } }
public int tbProPathMenthodAdd(tbProPathClass Customer) { int intFalg = 0; try { tbDai = new tbDaiConnection(); oledCon = tbDai.OledCon(); string strAdd = "insert into tb_ProPath "; strAdd += "values('" + Customer.ProID + "','" + Customer.ProName + "','" + Customer.ProPath + "')"; oledCmd = new OleDbCommand(strAdd, oledCon); if (oledCmd.ExecuteNonQuery() != 0) { intFalg = 1;//添加成功 } return(intFalg); } catch (Exception ee) { return(intFalg); } }// end fi
}// end if #endregion #region //删除商品类别信息 成功返回1,失败返回0 public int tbProPathUpdate(tbProPathClass Customer) { int intFalg = 0; try { tbDai = new tbDaiConnection(); oledCon = tbDai.OledCon(); string strAdd = "update tb_ProPath set "; strAdd += "ProPath='" + Customer.ProPath + "' where ProID='" + Customer.ProID + "' "; oledCmd = new OleDbCommand(strAdd, oledCon); if (oledCmd.ExecuteNonQuery() != 0) { intFalg = 1;//添加成功 } return(intFalg); } catch (Exception ee) { return(intFalg); } }// end fi