且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将 Excel 范围转换为 ADO.NET 数据集或数据表等

更新时间:2023-02-14 11:49:42

内置函数我不知道,不过自己写应该不难.伪代码:

I don't know about a built-in function, but it shouldn't be difficult to write it yourself. Pseudocode:

DataTable MakeTableFromRange(Range range)
{
   table = new DataTable
   for every column in range
   {
      add new column to table
   }
   for every row in range
   {
      add new datarow to table
      for every column in range
      {
         table.cells[column, row].value = range[column, row].value
      }
   }
   return table
}