在.NET中可以用OleDb(Object linking and embeding DataBase)来访问Excel using System; using System.Data; using System.Windows.Forms; using System.Data.OleDb; namespace ExcelDemo { public partial class Form1 : Form { public Form1() { InitializeComponent(); } pri
参考: How to read from an Excel file using OLEDB 为了使用方便,我做成了工具类(OledbCommon.cs),好以后使用. 注:连接字符串中,Provider=xx是从这个连接模仿,主要是考虑是否把第1行当成表头: http://www.connectionstrings.com/excel/ OledbCommon.cs类的代码: using System; using System.Collections.Generic; using Syste
如果我们有例如以下一个Excel表格: 如今要使用C#程序读取其内容: using System; using System.Data.OleDb; namespace Skyiv.Ben.Test { sealed class ExcelTest { static void Main() { try { using (OleDbConnection conn = new OleDbConnection