📄 form1.cs
字号:
this.oleDbDataAdapter1.Fill(this.ds_student);
// this.dataGrid1.ReadOnly=true;
this.dataGrid1.DataSource=this.ds_student.Tables[0];
}
private void menuItem9_Click(object sender, System.EventArgs e)
{
this.Close();
}
//更新数据
private void button3_Click(object sender, System.EventArgs e)
{
if(flag==0)
{
if(this.ds_student.HasChanges()==true)
{
// DataSet change=this.ds_student.GetChanges();
// this.ds_student.AcceptChanges();
// this.oleDbDataAdapter1.Update(change);
// this.dataGrid1.Refresh();
MessageBox.Show("不允许更改");
}
}
if(flag==1)
{
if(this.ds_action.HasChanges()==true)
{
DataSet change1=this.ds_action.GetChanges();
this.ds_action.AcceptChanges();
this.oleDbDataAdapter2.Update(change1);
this.dataGrid1.Refresh();
recommendation.Form3 f=new Form3();
f.Show();
}
}
if(flag==2)
{
if(this.ds_rule.HasChanges()==true)
{
DataSet change2=this.ds_rule.GetChanges();
this.ds_rule.AcceptChanges();
this.oleDbDataAdapter3.Update(change2);
this.dataGrid1.Refresh();
}
}
if(flag==4)
{
if(this.ds_original.HasChanges()==true)
{
DataSet change2=this.ds_original.GetChanges();
this.ds_original.AcceptChanges();
this.oleDbDataAdapter3.Update(change2);
this.dataGrid1.Refresh();
}
}
if(flag==5)
{
if(this.ds_power.HasChanges()==true)
{
DataSet change2=this.ds_power.GetChanges();
this.ds_power.AcceptChanges();
this.oleDbDataAdapter3.Update(change2);
this.dataGrid1.Refresh();
}
}
}
private void menuItem5_Click(object sender, System.EventArgs e)
{
this.flag=1;
this.ds_action.Clear();
this.oleDbDataAdapter2.Fill(this.ds_action);
this.dataGrid1.DataSource=this.ds_action.Tables[0];
this.dataGrid1.Refresh();
}
//查看评比结果
private void menuItem7_Click(object sender, System.EventArgs e)
{
recommendation.Form4 result=new Form4();
result.Show();
}
private void oleDbDataAdapter1_RowUpdated(object sender, System.Data.OleDb.OleDbRowUpdatedEventArgs e)
{
}
// private void treeView1_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
// {
// string cs = this.treeView1.SelectedNode.Text.ToString();
// if(cs == "专业成绩数据")
// {
// this.flag=0;
// this.ds_student.Clear();
// this.oleDbDataAdapter1.Fill(this.ds_student);
// this.dataGrid1.DataSource=this.ds_student.Tables[0];
// }
// if(cs=="行为积分数据")
// {
// this.flag=2;
// this.ds_rule.Clear();
// this.oleDbDataAdapter3.Fill(this.ds_rule);
// this.dataGrid1.DataSource=this.ds_rule.Tables[0];
// this.dataGrid1.Refresh();
//
// }
// if(cs=="加分规则")
// {
//
// this.flag=1;
// this.ds_action.Clear();
// this.oleDbDataAdapter2.Fill(this.ds_action);
// this.dataGrid1.DataSource=this.ds_action.Tables[0];
// this.dataGrid1.Refresh();
//
// }
// if(cs=="开始评选")
// {
// recommendation.Form4 result=new Form4();
// result.Show();
// }
// if(cs=="退出程序")
// {
// Application.Exit();
// }
//
// }
private void menuItem8_Click(object sender, System.EventArgs e)
{
}
private void menuItem10_Click(object sender, System.EventArgs e)
{
this.flag=4;
this.ds_original.Clear();
this.oleDbDataAdapter4.Fill(this.ds_original);
this.dataGrid1.DataSource=this.ds_original.Tables[0];
this.dataGrid1.Refresh();
}
private void menuItem11_Click(object sender, System.EventArgs e)
{
this.flag=5;
this.ds_power.Clear();
this.oleDbDataAdapter5.Fill(this.ds_power);
this.dataGrid1.DataSource=this.ds_power.Tables[0];
this.dataGrid1.Refresh();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -