将Linq添加到数据集(我不能使用FillDataset)

时间:2016-05-14 13:28:08

标签: c# linq

我的简单代码是:

  

我的按钮生成报告

private void button1_Click(object sender, EventArgs e)
    {

        DataSet ds = new DataSet();
        ds.Locale = CultureInfo.InvariantCulture;
        // i can't type "FillDataSet(ds)" it can't shown
        saveFileDialog1.Filter = "Excel File|*.xls"; 

        IEnumerable<DataRow> query = from db in Program.data.Transactions.AsEnumerable() where db.StartDate == dateTimePicker1.Value.Date  select db;

        DataTable boundTable = query.CopyToDataTable<DataRow>();

我不能使用fillDataSet,任何人都知道为什么?

我用:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Excel = Microsoft.Office.Interop.Excel;
using System.Data.DataRowExtensions;
using System.Globalization;

0 个答案:

没有答案