/// <summary> /// 读取excel文档 /// </summary> /// <param name="path">文件名称</param> /// <returns>返回一个数据集</returns> public dataset exceltods(string path) { string strconn = "provider=microsoft.jet.oledb.4.0;" +"data source="+ path +";"+"extended properties=excel 8.0;"; oledbconnection conn = new oledbconnection(strconn); conn.open(); string strexcel = ""; oledbdataadapter mycommand = null; dataset ds = null; strexcel="select * from [sheet1$]"; mycommand = new oledbdataadapter(strexcel, strconn); ds = new dataset(); mycommand.fill(ds,"table1"); return ds; } 【推荐阅读:[2005-06-13]IssueVis】
前些日子,有很多朋友说需要c#导出到excel的代码,现共享给大家
... 下一页