import CSV File (Comma Seperated Value)??

jigax

Active member
Joined
Aug 17, 2006
Messages
43
Programming Experience
Beginner
Hello everyone,

I have two questions.

1. How can I import a CSV file into access programmatically?
2. The file that I’m importing has separate records for a work order for example.

w/o# custname custphone# address equiptment1
w/o# custname custphone# address equiptment2
w/o# custname custphone# address equiptment3
w/o# custname custphone# address equiptment4

When I import the CSV file into access manually I get multiple records for a w/o depending on the equipment the customer has. So what I’m trying to do is instead of having multiple lines for one w/o I want everything on one line (one record) e.g.

w/o# custname custphone# address equiptment1 equiptment2 equiptment3 equiptment4

Thanks in advance.
 
Your question is not very clear.

When I import the CSV file into access manually
How do you mean manually? DO you mean using the Access GUI?
How are you creating the CSV file? Is that the part you need help with?
Do you know how to use DataSets or ADO.NET in general?
 
I have a CSV file that has the following format.

job# cust# Address phone number equipment1
job# cust# Address phone number equipment2
job# cust# Address phone number equipment3
job# cust# Address phone number equipment4

this is just one job# what I’m trying to do is have all the equipment fields align next to each other instead of having multiple lines for just one job# e.g.

job# cust# Address phone number equipment1 equipment2 equipment3 equipment4

And can this be done at import time programmatically? Because I’m currently importing the file via ACCESS

I have very little vb knowledge I’ve dealt with vb6 and vb.net ado and ado.net very little as well. But if you guide me on what to read up one I can figure it out.

Thank you.

 
CSV into Access?

I'm a vb.net newbie trying to connect to a CSV file copy it's contents and then connect to a MDB file and somehow paste the contents to it (e.g. import) I have manage to connect to a CSV file read it's contents and close the connection after that I’m lost. Can someone please give me a hand? Here is the code I have so far.


VB.NET:
Imports System.Data.Odbc
PublicClass Form1
Dim connectionstring AsString = "Driver={Microsoft Text Driver (*.txt; *.csv)};DBQ=C:\"
Dim csvreader As OdbcDataReader
Dim csvconnection As OdbcConnection
Dim csvcommand As OdbcCommand
PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
csvconnection = New OdbcConnection(connectionstring)
csvconnection.Open()
csvcommand = csvconnection.CreateCommand
csvcommand.CommandText = "Select * from [sample.csv]"
csvcommand.CommandType = CommandType.Text
csvreader = csvcommand.ExecuteReader
csvconnection.Close()
EndSub
EndClass

Thanks in advance guys!
 
Last edited by a moderator:
Back
Top