By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,041 Members | 1,858 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,041 IT Pros & Developers. It's quick & easy.

How to copy mdb access and convert into excel file in vb.net?

P: 9
Expand|Select|Wrap|Line Numbers
  1. catNewDB.Create("Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" + newpath + "\DDCOS.mdb")
  2.             Dim cmdd As New OleDb.OleDbCommand("CREATE TABLE DDCOS( " & _
  3.                "RecNum int identity," & "ZipFile NVarchar(50)," & "DvdName NVarchar(50)," & "SeqNo1 NVarchar(50)," & "SeqNo2 NVarchar(50)," & _
  4.             "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)
  5.             conns.Open()
  6.  
  7.  
  8. 'Convert into xlsx
  9.             Dim AccessCommand As New System.Data.OleDb.OleDbCommand("SELECT * INTO [Excel 12.0 Xml;DATABASE=C:\Users\admin\Documents\New folder (7)\CBATCH\DDCOS.xlsx;HDR=Yes;].[DDCOS] from [DDCOS]", conns)
  10.  
  11.             cmdd.ExecuteNonQuery()
  12.  
  13.             conns.Close()
  14.             GC.Collect()
  15.             GC.WaitForPendingFinalizers()
  16.  


I can convert it to xlsx but the column fields and values of the database was nothing inside of the xlsx. can someone help me?
Jan 29 '16 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.