private void cboInit() { SqlDataReader dr = SqlHelper.ExecuteReader("Select Code,Meaning From Codes Where Purpose='PlanState'"); BoxItem item = null; item = new BoxItem("全部", ""); cboShow.Items.Add(item); while (dr.Read()) { item = new BoxItem(); item.Text = dr["Meaning"].ToString(); item.Value = dr["Code"].ToString(); cboShow.Items.Add(item); } dr.Dispose(); cboShow.SelectedIndex = cboShow.Items.Count > 0 ? 0 : -1; }
private void cboinit() { DataSet ds = SqlHelper.ExecuteDataset("Select Code,Meaning From Codes Where Purpose='IntervalUnit'"); cboUnit.DataSource = ds.Tables[0]; cboUnit.DisplayMember = "Meaning"; cboUnit.ValueMember = "Code"; cboUnit.SelectedIndex = cboUnit.Items.Count > 0 ? 0 : -1; ds.Dispose(); ds = SqlHelper.ExecuteDataset("Select ID,Site_ID,Name From Post"); cboPost.DataSource = ds.Tables[0]; cboPost.DisplayMember = "Name"; cboPost.ValueMember = "ID"; cboPost.SelectedIndex = cboPost.Items.Count > 0 ? 0 : -1; ds.Dispose(); ds = SqlHelper.ExecuteDataset("Select ID,Name From CheckRoute"); cboRoute.DataSource = ds.Tables[0]; cboRoute.DisplayMember = "Name"; cboRoute.ValueMember = "ID"; cboRoute.SelectedIndex = cboRoute.Items.Count > 0 ? 0 : -1; ds.Dispose(); SqlDataReader dr = SqlHelper.ExecuteReader("Select Code,Meaning From Codes Where Purpose='PlanState'"); BoxItem item = null; item = new BoxItem("全部", ""); cboShow.Items.Add(item); while (dr.Read()) { item = new BoxItem(); item.Text = dr["Meaning"].ToString(); item.Value = dr["Code"].ToString(); cboShow.Items.Add(item); } dr.Dispose(); cboShow.SelectedIndex = cboShow.Items.Count > 0 ? 0 : -1; }
private void cboinit() { DataSet ds=SqlHelper.ExecuteDataset("Select Code,Meaning From Codes Where Purpose='IntervalUnit'"); cboUnit.DataSource=ds.Tables[0]; cboUnit.DisplayMember = "Meaning"; cboUnit.ValueMember = "Code"; cboUnit.SelectedIndex = cboUnit.Items.Count > 0 ? 0 : -1; ds.Dispose(); ds = SqlHelper.ExecuteDataset("Select ID,Site_ID,Name From Post"); cboPost.DataSource=ds.Tables[0]; cboPost.DisplayMember = "Name"; cboPost.ValueMember = "ID"; cboPost.SelectedIndex = cboPost.Items.Count > 0 ? 0 : -1; ds.Dispose(); ds = SqlHelper.ExecuteDataset("Select ID,Name From CheckRoute"); cboRoute.DataSource = ds.Tables[0]; cboRoute.DisplayMember = "Name"; cboRoute.ValueMember = "ID"; cboRoute.SelectedIndex = cboRoute.Items.Count > 0 ? 0 : -1; ds.Dispose(); SqlDataReader dr = SqlHelper.ExecuteReader("Select Code,Meaning From Codes Where Purpose='PlanState'"); BoxItem item = null; item = new BoxItem("全部",""); cboShow.Items.Add(item); while (dr.Read()) { item = new BoxItem(); item.Text = dr["Meaning"].ToString(); item.Value = dr["Code"].ToString(); cboShow.Items.Add(item); } dr.Dispose(); cboShow.SelectedIndex = cboShow.Items.Count > 0 ? 0 : -1; }