【ADO.Excel】ADO获取excel的Sheet集合

复制代码
 1 using (OleDbConnection connection = new OleDbConnection(GetConnectionString()))
 2                     {
 3                         connection.Open();
 4 
 5                         // See MSDN's "OLE DB Schema Collections (ADO.NET)" for the Microsoft Jet OLE DB Provider
 6                         //  http://msdn.microsoft.com/en-us/library/cc668764.aspx
 7                         using (DataTable tables = connection.GetSchema("Tables"))
 8                         {
 9                             foreach (DataRow row in tables.Rows)
10                                 comboBoxSheet.Items.Add((string)row["TABLE_NAME"]);
11                         }
12                     }
复制代码

 

posted @   哈哈好玩  阅读(405)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示