c#如何把excel数据存入一个二维数组中?
我想在用c#实现把excel数据存入一个二维数组中,并能在后台中显示出来。。
static void Main()
{
string connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Users\\lenovo\\Desktop\\testshuju.xls;Extended Properties=Excel 8.0";
OleDbConnection conn = new OleDbConnection(connStr);
conn.Open();
string strExcel = "";
OleDbDataAdapter myCommand = null;
DataSet ds = null;
strExcel = "select * from [sheet1$]";
myCommand = new OleDbDataAdapter(strExcel, connStr);
ds = new DataSet();
myCommand.Fill(ds, "table1");
}
接下来如何用Console.Write()显示出来这些数据?源程序还需要添加哪些代码?谢谢了。。