1.DataGridView轉DataTable
2.DataTable轉DataView
3.DataView轉DataTable
private System.Data.DataTable Get_lcg(DataGridView myDataGridView)
{
System.Data.DataTable mydataTable = new System.Data.DataTable();
System.Data.DataTable dt = ((System.Data.DataTable)myDataGridView.DataSource).Copy();
DataView dv = dt.DefaultView;
dv.RowFilter = string.Format("字段名 = '{0}')","字段查詢內容");
mydataTable = dv.ToTable(true, "字段一", "字段二", "字段三");
return mydataTable;
}
