private void AccountAddForm_Load(object sender, EventArgs e) { DataSet ds_eqType = null, ds_department = null, ds_Status=null ; AccountAdd aa = new AccountAdd(); ds_eqType = aa.CreateDataSet_EquipmentType(); ds_department = aa.CreateDataSet_Department(); ds_Status = aa.CreateDataSet_Status(); InitComboBox(combo_eqType, ds_eqType, "id", "type_name"); InitComboBox(combo_depart, ds_department, "id", "departname"); InitComboBox(combo_status, ds_Status, "id", "status_name"); }
public AccountEditForm(string id) { InitializeComponent(); accountId = id; DataSet ds_eqType = null, ds_department = null, ds_Status = null; DataSet ds = null; // DataTable data = null; AccountAdd aa = new AccountAdd(); Account ads = new Account(); //初始化下拉列表用 ds_eqType = aa.CreateDataSet_EquipmentType(); ds_department = aa.CreateDataSet_Department(); ds_Status = aa.CreateDataSet_Status(); //获取指定id的信息 ds = ads.queryAccountById(id); //ds2.Tables[0].Rows[0][] //log.Debug("设备类型是:"+ds.Tables[0].Rows[0][19].ToString()); InitComboBox(combo_eqType, ds_eqType, "id", "type_name",ds,"type"); InitComboBox(combo_depart, ds_department, "id", "departname",ds,"department"); InitComboBox(combo_status, ds_Status, "id", "status_name",ds ,"status"); text_asset.DataBindings.Add(new Binding("Text", ds.Tables[0], "asset")); text_eqname.DataBindings.Add(new Binding("Text",ds.Tables[0],"eqname")); text_model.DataBindings.Add(new Binding("Text", ds.Tables[0], "model")); text_specification.DataBindings.Add(new Binding("Text", ds.Tables[0], "specification")); text_weight.DataBindings.Add(new Binding("Text", ds.Tables[0], "weight")); text_brand.DataBindings.Add(new Binding("Text", ds.Tables[0], "brand")); text_manufacturer.DataBindings.Add(new Binding("Text", ds.Tables[0], "manufacturer")); text_supplier.DataBindings.Add(new Binding("Text", ds.Tables[0], "supplier")); maskedText_value.DataBindings.Add(new Binding("Value", ds.Tables[0], "value")); numeric_count.DataBindings.Add(new Binding("Value", ds.Tables[0], "count")); numeric_electromotor.DataBindings.Add(new Binding("Value", ds.Tables[0], "electromotor")); maskedText_power.DataBindings.Add(new Binding("Value", ds.Tables[0], "power")); dateTime_manu_date.DataBindings.Add(new Binding("Value", ds.Tables[0], "manu_date")); dateTime_produ_date.DataBindings.Add(new Binding("Value", ds.Tables[0], "produ_date")); dateTime_filing_date.DataBindings.Add(new Binding("Value", ds.Tables[0], "filing_date")); text_address.DataBindings.Add(new Binding("Text", ds.Tables[0], "address")); img = (byte[])(ds.Tables[0]).Rows[0][21]; threeD = (byte[])(ds.Tables[0]).Rows[0][22]; }