public Platform(DaoPlatform pltfm, DataService service, FmDb par) { InitializeComponent(); this.pltfm = pltfm; this.service = service; parent = par; labName.Text = pltfm.name; labInfo.Text = pltfm.info; }
//获取所有 platform 记录 public List <DaoPlatform> getAllPltfms() { List <DaoPlatform> list = null; if (con != null) { try { if (con.State != ConnectionState.Open) { con.Open(); } list = new List <DaoPlatform>(); string queryStr = @"select * from tabplatforms;"; MySqlCommand cmd = new MySqlCommand(); cmd.Connection = con; cmd.CommandText = queryStr; using (MySqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { DaoPlatform one = new DaoPlatform(); one.id = reader.GetInt16(0); one.name = reader.GetString(1); one.info = reader.GetString(2); list.Add(one); } } } catch (Exception ex) { Console.WriteLine("getpltfm Error!\n" + ex.Message); } } return(list); }