473,382 Members | 1,480 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

MS Access and VB.NET

I am attempting to automate the process within a vb.net windows application
of importing a text file into an access database (setting the column
seperators, first row being column names and such) but I am not finding
examples of this on the net? Has anyone ran across such a thing?
Nov 20 '05 #1
13 1755
* "scorpion53061" <sc************@nospamhereeveryahoo.com> scripsit:
I am attempting to automate the process within a vb.net windows application
of importing a text file into an access database (setting the column
seperators, first row being column names and such) but I am not finding
examples of this on the net? Has anyone ran across such a thing?


Did you have a look at <URL:http://www.connectionstrings.com/>?

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #2
How does this help with importing text files into MS Access? What I am
trying to do is code an action that duplicates the MS Access Import Wizard
we use when we want to import a text file into access?

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:c6************@ID-208219.news.uni-berlin.de...
* "scorpion53061" <sc************@nospamhereeveryahoo.com> scripsit:
I am attempting to automate the process within a vb.net windows application of importing a text file into an access database (setting the column
seperators, first row being column names and such) but I am not finding
examples of this on the net? Has anyone ran across such a thing?


Did you have a look at <URL:http://www.connectionstrings.com/>?

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #3
Hi scorpion,
You probably have a CSV file that you want to import to Database. Here is an
example how to fill datatable from CSV file. It will get you started

Private Sub ConnectToText_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)
Handles ConnectToText.Click

'Establish a connection to the data source.
Dim sConnectionString As String

sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=d:\My Documents\TextFiles;Extended
Properties=Text;"
Dim objConn As New
System.Data.OleDb.OleDbConnection(sConnectionStrin g)
objConn.Open()

Dim da As New System.Data.OleDb.OleDbDataAdapter("Select * from
People.txt", objConn)

Dim ds As New DataSet("PeopleFile")

da.Fill(ds, "People.txt")

Dim dt As DataTable
dt = ds.Tables("People.txt")

Dim drCurrent As DataRow
For Each drCurrent In dt.Rows
Console.WriteLine("{0} {1}", _
drCurrent("0").ToString, _
drCurrent("1").ToString)
Next

objConn.Close()

End Sub

"scorpion53061" <sc************@nospamhereeveryahoo.com> wrote in message
news:u#**************@TK2MSFTNGP12.phx.gbl...
How does this help with importing text files into MS Access? What I am
trying to do is code an action that duplicates the MS Access Import Wizard
we use when we want to import a text file into access?

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:c6************@ID-208219.news.uni-berlin.de...
* "scorpion53061" <sc************@nospamhereeveryahoo.com> scripsit:
I am attempting to automate the process within a vb.net windows application of importing a text file into an access database (setting the column
seperators, first row being column names and such) but I am not finding examples of this on the net? Has anyone ran across such a thing?


Did you have a look at <URL:http://www.connectionstrings.com/>?

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>


Nov 20 '05 #4
Hi Scorpion,

Do you want a text file or a document file (word.doc)?

Cor
Nov 20 '05 #5
* "scorpion53061" <sc************@nospamhereeveryahoo.com> scripsit:
How does this help with importing text files into MS Access? What I am
trying to do is code an action that duplicates the MS Access Import Wizard
we use when we want to import a text file into access?


Yep. One approach is to load data from the text file and then insert it
in Access.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #6
On Mon, 19 Apr 2004 08:57:16 -0500, "scorpion53061" <sc************@nospamhereeveryahoo.com> wrote:

¤ How does this help with importing text files into MS Access? What I am
¤ trying to do is code an action that duplicates the MS Access Import Wizard
¤ we use when we want to import a text file into access?
¤

You don't really need to use automation with MS Access to do this:

Function ImportTextToAccess() As Boolean

Dim AccessConn As New System.Data.OleDb.OleDbConnection("Provider=Micros oft.Jet.OLEDB.4.0;"
& _
"Data Source=d:\My Documents\db1.mdb")

AccessConn.Open()

'New table
'Dim AccessCommand As New System.Data.OleDb.OleDbCommand("SELECT * INTO [tbl1] FROM
[Text;DATABASE=d:\My Documents\TextFiles].[CSV.txt]", AccessConn)
'Existing table
Dim AccessCommand As New System.Data.OleDb.OleDbCommand("INSERT INTO [tbl1] (F1, F2, F3, F4,
F5) SELECT F1, F2, F3, F4, F5 FROM [Text;DATABASE=d:\My Documents\TextFiles;].[CSV.txt]",
AccessConn)

AccessCommand.ExecuteNonQuery()
AccessConn.Close()

End Function
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)
Nov 20 '05 #7
These answers have all been helpful.

Thank you especially Herfried for not understanding what you were getting at
before.

"scorpion53061" <sc************@nospamhereeveryahoo.com> wrote in message
news:u%****************@TK2MSFTNGP12.phx.gbl...
How does this help with importing text files into MS Access? What I am
trying to do is code an action that duplicates the MS Access Import Wizard
we use when we want to import a text file into access?

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:c6************@ID-208219.news.uni-berlin.de...
* "scorpion53061" <sc************@nospamhereeveryahoo.com> scripsit:
I am attempting to automate the process within a vb.net windows application of importing a text file into an access database (setting the column
seperators, first row being column names and such) but I am not finding examples of this on the net? Has anyone ran across such a thing?


Did you have a look at <URL:http://www.connectionstrings.com/>?

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>


Nov 20 '05 #8
text file
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:Or**************@TK2MSFTNGP12.phx.gbl...
Hi Scorpion,

Do you want a text file or a document file (word.doc)?

Cor

Nov 20 '05 #9
Hi Scorpion,

Than it is easy, just read it and put it in a field.

I had already made a serialise routine for you to do it with a doc file and
I did thought that without asking if that was needed you would probably not
have understanded it why I did it that difficult.

Cor
Nov 20 '05 #10
I've never tried to do this myself, but I suspect you're going to have
to use automation and invoke a VBA procedure in the mdb to do it.

--Mary

On Mon, 19 Apr 2004 06:40:35 -0500, "scorpion53061"
<sc************@nospamhereeveryahoo.com> wrote:
I am attempting to automate the process within a vb.net windows application
of importing a text file into an access database (setting the column
seperators, first row being column names and such) but I am not finding
examples of this on the net? Has anyone ran across such a thing?


Nov 20 '05 #11
Hi Mary,

Would you know where to go to find an example of this?
That is kind of where I was headed originally.

"Mary Chipman" <mc***@online.microsoft.com> wrote in message
news:q4********************************@4ax.com...
I've never tried to do this myself, but I suspect you're going to have
to use automation and invoke a VBA procedure in the mdb to do it.

--Mary

On Mon, 19 Apr 2004 06:40:35 -0500, "scorpion53061"
<sc************@nospamhereeveryahoo.com> wrote:
I am attempting to automate the process within a vb.net windows applicationof importing a text file into an access database (setting the column
seperators, first row being column names and such) but I am not finding
examples of this on the net? Has anyone ran across such a thing?

Nov 20 '05 #12
Try one of the microsoft.public.msaccess newsgroups that deal with
programming since you'll need to use VBA.

--Mary

On Wed, 21 Apr 2004 10:35:11 -0500, "scorpion53061"
<sc************@nospamhereeveryahoo.com> wrote:
Hi Mary,

Would you know where to go to find an example of this?
That is kind of where I was headed originally.

"Mary Chipman" <mc***@online.microsoft.com> wrote in message
news:q4********************************@4ax.com.. .
I've never tried to do this myself, but I suspect you're going to have
to use automation and invoke a VBA procedure in the mdb to do it.

--Mary

On Mon, 19 Apr 2004 06:40:35 -0500, "scorpion53061"
<sc************@nospamhereeveryahoo.com> wrote:
>I am attempting to automate the process within a vb.net windowsapplication >of importing a text file into an access database (setting the column
>seperators, first row being column names and such) but I am not finding
>examples of this on the net? Has anyone ran across such a thing?
>


Nov 20 '05 #13
Also, a good resource for all things Access is
http://www.mvps.org/access/.

--Mary

On Wed, 21 Apr 2004 10:35:11 -0500, "scorpion53061"
<sc************@nospamhereeveryahoo.com> wrote:
Hi Mary,

Would you know where to go to find an example of this?
That is kind of where I was headed originally.

"Mary Chipman" <mc***@online.microsoft.com> wrote in message
news:q4********************************@4ax.com.. .
I've never tried to do this myself, but I suspect you're going to have
to use automation and invoke a VBA procedure in the mdb to do it.

--Mary

On Mon, 19 Apr 2004 06:40:35 -0500, "scorpion53061"
<sc************@nospamhereeveryahoo.com> wrote:
>I am attempting to automate the process within a vb.net windowsapplication >of importing a text file into an access database (setting the column
>seperators, first row being column names and such) but I am not finding
>examples of this on the net? Has anyone ran across such a thing?
>


Nov 20 '05 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

63
by: Jerome | last post by:
Hi, I'm a bit confused ... when would I rather write an database application using MS Access and Visual Basic and when (and why) would I rather write it using Visual Studio .Net? Is it as easy...
13
by: bill | last post by:
I am trying to convince a client that dotNet is preferable to an Access project (ADP/ADE). This client currently has a large, pure Access MDB solution with 30+ users, which needs to be upgraded....
1
by: Dave | last post by:
Hello NG, Regarding access-declarations and member using-declarations as used to change the access level of an inherited base member... Two things need to be considered when determining an...
13
by: Simon Bailey | last post by:
I am a newcomer to databases and am not sure which DBMS to use. I have a very simplified knowledge of databases overall. I would very much appreciate a (simplifed) message explaining the advantages...
0
by: Frederick Noronha \(FN\) | last post by:
---------- Forwarded message ---------- Solutions to Everyday User Interface and Programming Problems O'Reilly Releases "Access Cookbook, Second Edition" Sebastopol, CA--Neither reference book...
20
by: Olav.NET | last post by:
I am a .NET/C++ developer who is supposed to do some work with Access. I do not know much about it except for the DB part. Questions: *1* I am looking for INTENSIVE books to get quickly up to...
64
by: John | last post by:
Hi What future does access have after the release of vs 2005/sql 2005? MS doesn't seem to have done anything major with access lately and presumably hoping that everyone migrates to vs/sql. ...
1
by: com | last post by:
Extreme Web Reports 2005 - Soft30.com The wizard scans the specified MS Access database and records information such as report names, parameters and subqueries. ......
17
by: Mell via AccessMonster.com | last post by:
Is there a way to find out where an application was created from? i.e. - work or home i.e. - if application sits on a (work) server/network, the IT people know the application is sitting...
37
by: jasmith | last post by:
How will Access fair in a year? Two years? .... The new version of Access seems to service non programmers as a wizard interface to quickly create databases via a fancy wizard. Furthermore, why...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.