如何将数据从BindingSource转换为DataTable

时间:2016-01-07 10:36:26

标签: c# datatable bindingsource

    BindingList<DocumentField> bindingList = new BindingList<DocumentField>(args.recognizedFields);
    BindingSource source = new BindingSource(bindingList, null);
    dataGridDocumentFields.DataSource = source;
    DataTable dt = (DataTable)(((BindingSource)source.DataSource).DataSource); 

最后一行抛出异常;

  

“无法将'System.Windows.Forms.BindingSource'类型的对象强制转换为   输入'System.Data.DataTable'。“

0 个答案:

没有答案