C#源码读取excel数据到程序中-SQL SERVER-到dataset中
|
日期:2007年7月3日 作者: 查看:[大字体
中字体 小字体]
|
/// </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 [Recovered_Sheet1$]"; myCommand = new OleDbDataAdapter(strExcel, strConn); ds = new DataSet(); myCommand.Fill(ds); return ds; }
/// <summary> /// 写入Excel文档 /// </summary> /// <param name="Path">文件名称</param> //public bool SaveFP2toExcel(string Path) //{ // try // { // string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + Path + ";" + "Extended Properties=Excel 8.0;"; // OleDbConnection conn = new OleDbConnection(strConn);
上一篇:最详细的SQL注入相关的命令整理
下一篇:怎样将Excel中的数据导入到SQLServer2000数据库中
|
| C#源码读取excel数据到程序中-SQL SERVER-到dataset中 相关文章: |
|
|
|
| C#源码读取excel数据到程序中-SQL SERVER-到dataset中 相关软件: |
|
|
|