zoukankan      html  css  js  c++  java
  • a universal class to complete import data from an excel file into a database

    How can i do that?
    two file
    one is update data to database

    first step
    i will define two sesion to write the operating table and operating columns in server.
    two step
    tell the customer where and how many columns they can update.

    列显示名称1:真实列名1#列显示名称1:真实列名1#列显示名称1:真实列名1

    //get the data from excle
    string strConn="Provider=Microsoft.Jet.OleDb.4.0;Data Source=d:\\收支表.XLS;Extended Properties=\"Excel 8.0;\"";
    OleDbConnection conn=new OleDbConnection(strConn);
    conn.Open();
    OleDbDataAdapter da=new OleDbDataAdapter("select * from [Sheet1$]",conn);
    DataSet ds=new DataSet();
    //import data to a dataset
    da.Fill(ds,“tablename“);

    //define sql Dataadapter
    define a dataadapter
    SqlDataAdapter adapter = new SqlDataAdapter();
    adapter.SelectCommand = new SqlCommand(query, conn);
    adapter.Update(ds,“tablename“)




    another is import data to database
  • 相关阅读:
    element input number e
    地图 scatter 自定义图片
    地图某一个区域设置高亮
    echarts 获取县级json
    echarts map 阴影(重叠)
    echarts 渐变色
    echarts tooltip 超出处理
    npm 下载 zip
    axios post 下载文件
    书签 css
  • 原文地址:https://www.cnblogs.com/king_astar/p/754.html
Copyright © 2011-2022 走看看