private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { count.Text = getDateCountAD(comboBox1.Text).ToString(); sda = DBhelper.GetSDA("select * from ad where date='" + comboBox1.Text + "' "); SqlCommandBuilder acb = new SqlCommandBuilder(sda); DataSet ds = new DataSet(); sda.Fill(ds, "st"); dt = ds.Tables["st"]; dataGridView1.DataSource = dt; }
private void empinfo_Load(object sender, EventArgs e) { getLastId(); sda = DBhelper.GetSDA("select id as 员工ID,eid as 员工工号, ename as 员工姓名,eage as 年龄,etel as 联系方式,ecreatedate as 入职日期 from employee"); SqlCommandBuilder acb = new SqlCommandBuilder(sda); DataSet ds = new DataSet(); sda.Fill(ds, "st"); dt = ds.Tables["st"]; dataGridView1.DataSource = dt; }
private void alterdept_Load(object sender, EventArgs e) { id = getDeptCount(); //注意要查询到主键,否则会报错 sda = DBhelper.GetSDA("select id as 部门ID, dname as 部门名称,dtel as 部门联系方式 from dept"); SqlCommandBuilder acb = new SqlCommandBuilder(sda); DataSet ds = new DataSet(); sda.Fill(ds, "st"); dt = ds.Tables["st"]; dataGridView1.DataSource = dt; }
private void deletead_Load(object sender, EventArgs e) { setDate(); System.DateTime currentTime = new System.DateTime(); currentTime = System.DateTime.Now; String strYMD = currentTime.ToLongDateString(); comboBox1.Text = strYMD; sda = DBhelper.GetSDA("select * from ad where date='" + comboBox1.Text + "' "); SqlCommandBuilder acb = new SqlCommandBuilder(sda); DataSet ds = new DataSet(); sda.Fill(ds, "st"); dt = ds.Tables["st"]; dataGridView1.DataSource = dt; this.dataGridView1.Columns[0].FillWeight = 20; this.dataGridView1.Columns[1].FillWeight = 170; }