//属性textbox绑定 public void PropertyBind() { try { conn.Open(); string sqlstr = "select * from fwproperty where 防火墙ID='" + StaticGlobal.firewallmac + "'"; StaticGlobal.FireWalldevices[StaticGlobal.firewallindex].getproperty_list().Clear(); StaticGlobal.property.Clear(); MySqlCommand cm = new MySqlCommand(sqlstr, conn); MySqlDataReader dr = cm.ExecuteReader(); //绑定 while (dr.Read()) { PropertyDataTble datatable = new PropertyDataTble(); datatable.fwname = dr[0].ToString(); datatable.fwID = dr[1].ToString(); datatable.fwIP = dr[2].ToString(); datatable.description = dr[3].ToString(); StaticGlobal.FireWalldevices[StaticGlobal.firewallindex].getproperty_list().Add(datatable); StaticGlobal.property.Add(datatable); } dr.Close(); } catch (Exception e) { Console.WriteLine("exceptionInfo {0}", e); } finally { conn.Close(); } }
public void addproperty_list(PropertyDataTble fwrdt) { propertyLists.Add(fwrdt); }