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
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!
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

CodeCruiserCommented:
>gives error even though they are there.

What's the error?

Do you need it in winforms or asp.net?
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!
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
CodeCruiserCommented:
Again, is it for winforms or asp.net?
pauledwardianAuthor Commented:
TI is for winform.
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

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?
pauledwardianAuthor Commented:
Thanks guys!
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.