我已经在项目中定义了一个数据集。
在通过此查询过滤后,我想用此数据集填充datagridview:
以上代码中包含的问题。
基本上,这些步骤正确吗?
谢谢!
在通过此查询过滤后,我想用此数据集填充datagridview:
C#:
private void updatedgv(DataGridView dgv)
{
// this.timeDataTableAdapter1.Fill(this.timeDataSet.TimeData);
数据表 dt_TimeData = timeDataSet.Tables["TimeData"];
var qryTimeDataSource = from a in dt_TimeData.AsEnumerable()
orderby a.Field<String>("EmployeeNo")
where (a.Field<String>("EmployeeNo") == txtEmployeeNumber.Text)
&& (a.Field<DateTime>("Date") == dateTimePicker1.Value)
select a;
// How do I convert the above query to what I need to fill the table adapter with?
this.timeDataTableAdapter1.Fill("I believe a new table from the above query goes here...");
// This is wrong...
dgv.DataSource = qryTimeDataSource;
以上代码中包含的问题。
基本上,这些步骤正确吗?
- 数据表
- 询问
- 用表填充表适配器(源自查询)
谢谢!