畅想!!

馨园

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
    首先要说一下自己写的一个帮助类ExcelHelper。可以用两种方式访问Excel文件,一种是以ExcelCom组件的形式,一种是最简单的把Excel看作是数据库。
  using
 System;
using
 System.IO;
using
 System.Collections;
using
 System.Text;

using
 System.Data;
using
 System.Data.OleDb;

namespace
 com.urp.command.FileFrameWork.Helper
{
    
/// <summary>
    
/// Class1 的摘要说明。
    
/// </summary>

    public class ExcelHelper
    
{
        
private readonly string readConn = "Provider=Microsoft.Jet.OLEDB.4.0;" +"Data Source={0};"

            
+"Extended Properties='Excel 8.0;HDR=YES;IMEX=1;'";

        
private readonly string writeConn = "Provider=Microsoft.Jet.OLEDB.4.0;" +"Data Source={0};"

            
+"Extended Properties='Excel 8.0;HDR=YES;'"
        
        
private OleDbConnection _conn = null
;
        
private OleDbCommand _command = null
;
        
private OleDbDataAdapter _adapter = null
;
        
private OleDbCommandBuilder _builder = null
;

        
private Excel.Application _application =  null
;
        
private Excel._Workbook _workBook = null
;
        
private Excel._Worksheet _workSheet = null
;
        
private Excel.Range _range =  null
;

        
private int
 _columnCount;
        
private int
 _rowCount;

        
private object _missingValue =
 System.Reflection.Missing.Value;

        
public ExcelHelper(string
 path)
        


        
public ExcelHelper()
        


        
ComExcel

        
ADO.Net
    }

}
posted on 2007-04-18 16:15  阿乐01  阅读(973)  评论(1编辑  收藏  举报