Solved

VB.net Import text file into SQL table

Posted on 2014-11-25
7
413 Views
Last Modified: 2014-11-25
Hi

I use SQL Server Management Studio to import text files into my SQL table.
I now want to do this programmatically in my Windows Forms app.
What VB.net code would I use to do this?
Thanks
0
Comment
Question by:murbro
  • 3
  • 3
7 Comments
 
LVL 4

Expert Comment

by:edwardq
ID: 40464384
How big of a text file?   I been reading the text file into vb.net and then inserting each line via sql statement.
0
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 40464387
Have a look at the free FileHelpers library to read your files: http://emoreau.com/Entries/Articles/2011/11/Using-the-FileHelpers-Library.aspx
0
 

Author Comment

by:murbro
ID: 40464392
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:murbro
ID: 40464400
Incidentally, my project is an Excel add-in. Would it be a good idea to perhaps open the .csv or .txt file in Excel the run code to create a dataset/datatable from Excel
0
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 40464403
What I don't like about Excel is that it will try to convert some fields for you and the result is not always accurate. I prefer to process raw files.
0
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 500 total points
ID: 40464407
As for your other link, there are so many ways of reading/processing files that it will depend on your actual needs and mostly your data files (header or not, formatted or not, ...)

I find myself using a combination of multiple methods because I never found one solution to fit all the files I have to process for one of my clients.
0
 

Author Closing Comment

by:murbro
ID: 40464469
Thanks very much Eric. I hadn't realised how complicated this process is
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now