VB.net Import text file into SQL table

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
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

EdwardCommented:
How big of a text file?   I been reading the text file into vb.net and then inserting each line via sql statement.
0
Éric MoreauSenior .Net ConsultantCommented:
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
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
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
Éric MoreauSenior .Net ConsultantCommented:
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
Éric MoreauSenior .Net ConsultantCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks very much Eric. I hadn't realised how complicated this process is
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.