zoukankan      html  css  js  c++  java
  • Excel转DataSet的一个例子

    public   static  DataSet ExcelToDS( string  Pathm, string  TableName)
            
    {
                DataSet ds 
    =   new  DataSet();
                
    try
                
    {
                    
    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 ;
                    strExcel 
    =   string .Format( " select * from [{0}$] " ,TableName);
                    myCommand 
    =   new  OleDbDataAdapter(strExcel, strConn);

                    myCommand.Fill(ds, TableName);
                }

                
    catch (Exception ex)
                
    {
                    System.Windows.Forms.MessageBox.Show(ex.Message);
                }

                
    return  ds;
            }
     
  • 相关阅读:
    pipeline+sonar
    ThinkPHP 3.2.3 使用 PHPExcel 处理 Excel 表格
    mac下finder子目录直接打开终端
    golang之交叉编译设置
    cocos2dx 3.0 编译工程
    2dx 3.0环境配置(mac)
    golang调用动态库
    qt下用启动图
    qt在动态库里面加载widget的例子
    qt笔记
  • 原文地址:https://www.cnblogs.com/cl1024cl/p/6204976.html
Copyright © 2011-2022 走看看