Getting an error when trying to connect using the SqlConnection

I am getting the following error when  write out this line of code.

Imports System.Data
Imports System.Data.SqlClient
 Dim conStr As String = "SERVER=LMI167\DBTEST;Database =ORKA Test; trusted_connection= yes"
        Dim objcon As New SqlConnection(conStr)

Open in new window


Reference required to assembly 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=969db8053d3322ac, Retargetable=Yes' containing the base class 'System.ComponentModel.Component'. Add one to your project.
cmdolcetAsked:
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.

ste5anSenior DeveloperCommented:
Check your projects properties first:

Capture.PNG
When you need .NET 2.0 as destination target, then you need to select it there.
cmdolcetAuthor Commented:
I was able to find my own solution. I was adding the reference and also trying to import the namespace It seemed like that caused the problem. I removed the reference and just kept the import of the namespace and it worked as expected.

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
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.