zoukankan      html  css  js  c++  java
  • ADO 读写文本文件

        ' 创建配置文件
       
       
        Open ThisWorkbook.Path & "schema.ini" For Append As #1
       
            Print #1, "[table2.csv] "
            Print #1, "Format=CSVDelimited "
            Print #1, "ColNameHeader=False"
            Print #1, "MaxScanRows=0"
            Print #1, "Col1=工号   Text   Width   50  "
            Print #1, "Col2=姓名   Text   Width   50  "
            Print #1, "Col3=入职日期   DateTime"
            Print #1, "Col4=班别   Text   Width   50  "
            Print #1, "Col5=职位   Text   Width   50  "
            Print #1, "Col6=分值补贴   Single"
            Print #1, "Col7=计件分钟   Single"
            Print #1, "col8=上班分钟   Single"
            Print #1, "col9=效率   Single"
            Print #1, " "
            Print #1, "[table1.csv]"
            Print #1, "Format=CSVDelimited  "
            Print #1, "ColNameHeader=False"
            Print #1, "MaxScanRows=0"
            Print #1, "Col1=c1   Text   Width   50  "
            Print #1, "Col2=c2   Text   Width   50  "
            Print #1, "Col3=c3   Text   Width   50  "
            Print #1, "Col4=c4   Text   Width   50  "
            Print #1, "Col5=c5   Text   Width   50  "
            Print #1, "Col6=工号   Text   Width   50  "
            Print #1, "Col7=c7   Text   Width   50  "
            Print #1, "Col8=款号   Text   Width   50  "
            Print #1, "Col9=c9   Text   Width   50  "
            Print #1, "Col10=c10   Text   Width   50  "
            Print #1, "Col11=c11   Text   Width   50  "
            Print #1, "Col12=c12   Text   Width   50  "
            Print #1, "Col13=c13   Text   Width   50  "
            Print #1, "Col14=c14   Text   Width   50  "
            Print #1, "Col15=c15   Text   Width   50  "
            Print #1, "Col16=c16   Text   Width   50  "
            Print #1, "Col17=车种   Text   Width   50  "
          
       
        Close #1


        On Error Resume Next
       
        Dim cnn As New ADODB.Connection
        cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & ThisWorkbook.Path & ";Extended Properties='text;HDR=No;FMT=Fixed';"
       
        If cnn.State = 0 Then
            Set cnn = Nothing
            MsgBox ("数据库连接失败!")
            Exit Sub
        End If
       
        Dim rec As New ADODB.Recordset
       
        rec.Open "select distinct t2.*, (t1.c1 + '-' + t1.c2 + '-1') as 更新时间, t1.款号, t1.车种 from table2.csv as t2" _
            & " left join table1.csv as t1 on t1.工号 = t2.工号" _
            & " order by t2.职位, t2.班别, t2.工号, t1.款号", cnn

  • 相关阅读:
    java.io.EOFException ValueOperations.increment()操作后,获取值时有的bug
    使用maven profile指定配置文件打包适用多环境
    关于3Q大战和反垄断
    在ECUG2010上的演讲稿
    让Windows7在启动时自动挂载虚拟磁盘
    也谈并行计算(一)C#版的Parallel.For实现
    给.NET的string类添加一个命令行参数分解的扩展
    顺序表 code
    很高兴开始博客之旅 code
    (原)前端知识杂烩(css系列)
  • 原文地址:https://www.cnblogs.com/lbnnbs/p/4785011.html
Copyright © 2011-2022 走看看