Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have CSV file and i need to export his data to my accesses database .mdb
or convert this CSV file to direct mdb database

What is the best way and best code to do that ?

What I have tried:

I have CSV file and i need to export his data to my accesses database .mdb
or convert this CSV file to direct mdb database
Posted
Updated 1-Sep-20 3:24am
Comments
F-ES Sitecore 31-Aug-20 12:58pm    
The best way is by writing some code :) Google "vb.net read csv file" and "vb.net write to access database", they're both well-documented things.

Create a LINKed table sourced from the .csv file. Then just do an INSERT INTO [targettable] ([fields]) SELECT [fields] FROM [sourcetable]
e.g.
SQL
INSERT INTO MyTarget (field1, field2, field3)
SELECT field1, field2, field3
FROM MySourceCSV
(Assuming you mean a programmatic solution; otherwise just copy'n'paste the data...)
 
Share this answer
 
Comments
Maciej Los 31-Aug-20 15:48pm    
5ed!
i found it

cmd.CommandText = "SELECT F1 AS firstname, F2 AS lastname " & "INTO MyNewTable " & "FROM [Text;FMT=Delimited;HDR=No;CharacterSet=850;DATABASE=C:\Users\eng_e\Desktop\MECABLE].List_of_Drums.csv;"

or 

        cmd.CommandText = "INSERT INTO Test " & "SELECT F1 AS F1, F2 AS F2 " & "FROM [Text;FMT=Delimited;HDR=No;CharacterSet=850;DATABASE=C:\Users\eng_e\Desktop\MECABLE].List_of_Drums.csv;"
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900