private void FrmEmp_Load(object sender, EventArgs e)
{
// TODO: 这行代码将数据加载到表“dsJobs.jobs”中。您可以根据需要移动或移除它。
this.jobsTableAdapter.Fill(this.dsJobs.jobs);
//DataRow row;
DsJobs.jobsRow row = dsJobs.jobs.NewjobsRow();
row.job_id = 0;
row.job_desc = "-----所有职务------";
row.min_lvl = 10;
row.max_lvl = 20;
dsJobs.jobs.AddjobsRow(row);
jobsBindingSource.Sort = "job_id";
}
private void button1_Click(object sender, EventArgs e)
{
short id;
DataRowView drv = jobsBindingSource.Current as DataRowView;
DsJobs.jobsRow row = drv.Row as DsJobs.jobsRow;
id = row.job_id;
if (id==0)
{
employeeTableAdapter.Fill(dsEmp.employee);
}
else
{
employeeTableAdapter.FillByJobId(dsEmp.employee, id);
}
}
代码就是这样子的,这是visual studio 2005的