如何创建mdb访问的副本并将其副本转换为同一文件夹中的csv?

时间:2016-01-21 08:38:30

标签: vb.net

conns =新OleDb.OleDbConnection(“Provider = Microsoft.Jet.OLEDB.4.0;”&“Data Source =”+ newpath +“\ DDCOS.mdb”)

    If Not File.Exists(newpath + "\DDCOS.mdb") Then
        catNewDB.Create("Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" + newpath + "\DDCOS.mdb")
        Dim cmdd As New OleDb.OleDbCommand("CREATE TABLE DDCOS( " & _
           "RecNum int identity," & "ZipFile NVarchar(50)," & "DvdName NVarchar(50)," & "SeqNo1 NVarchar(50)," & "SeqNo2 NVarchar(50)," & _
        "JobCode NVarchar(50)," & "ClientCode NVarchar(50)," & "TotalImages NVarchar(50)," & "TotalRecs NVarchar(50)," & "BatchCount NVarchar(50)," & "BatchDate NVarchar(50)," & "BatchSize NVarchar(50)," & "CONSTRAINT [pk_RecNum] PRIMARY KEY (RecNum)) ", conns)
        conns.Open()



        cmdd.ExecuteNonQuery()

        conns.Close()
        GC.Collect()
        GC.WaitForPendingFinalizers()
    End If

以上代码是我创建数据库的代码。现在我要创建一个副本并将副本转换为csv。有人可以帮忙吗?

1 个答案:

答案 0 :(得分:1)

Dim countOfMdb = Directory.EnumerateFiles(path, "*.mdb").Count()

Dim countOfMdb = Directory.GetFiles(path, "*.mdb").Length

如果要包含子目录:

Dim countOfMdb = Directory.GetFiles(path, "*.mdb", System.IO.SearchOption.AllDirectories).Length