VB or C# to import data to SQL

I am sort of beginner with both C# and vb so I am looking for a code that will import data from excel file into SQL. Does anyone have a sample code that would actually work? I tried a lot of online sample codes but each one gives me a different error. So, please if you have ever done something like this before and you have a code that would work fine post it here. I would really appreciate that.

Thank you,
Paul
pauledwardianAsked:
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.

pauledwardianAuthor Commented:
I used the second link (asp) application that you submitted but the lblmsg and GridView1 gives error even though they are there. Can you please try this on your side and yo will see what I mean.

Paul
0
pauledwardianAuthor Commented:
When I tried to change the path for excel file it says "'C:/users/My Computer/desktop/Files/importexcel2sqlserver/importexcel2sqlserver/example.xls' is a physical path, but a virtual path was expected."

Please advice!
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

CodeCruiserCommented:
>gives error even though they are there.

What's the error?

Do you need it in winforms or asp.net?
0
pauledwardianAuthor Commented:
That one I fixed. Now I want to know how to define the path for the excel file.
"When I tried to change the path for excel file it says "'C:/users/My Computer/desktop/Files/importexcel2sqlserver/importexcel2sqlserver/example.xls' is a physical path, but a virtual path was expected."

Please advice! "

Thanks!
0
pauledwardianAuthor Commented:
Do I need to create a virtual path? and if I do then how can I do it? Please provide step by step instructions if possible.

Paul
0
CodeCruiserCommented:
Again, is it for winforms or asp.net?
0
pauledwardianAuthor Commented:
TI is for winform.
0
adriankohwsCommented:
I have a tutorial together with source codes for you to download, sure to work.
http://www.youtube.com/watch?v=bF1OAHMDGQw&list=UUTdEQbGbbha8Bj8xFc0gPHQ&feature=plcp
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
CodeCruiserCommented:
Physical and virtual paths are for ASP.NET. Are you using a webbrowser control?
0
pauledwardianAuthor Commented:
Thanks guys!
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
.NET Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.