Solved

VB.net Import text file into SQL table

Posted on 2014-11-25
7
452 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 70

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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

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 70

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 70

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

776 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