Getting an error when trying to connect using the  SqlConnection

cmdolcet
cmdolcet used Ask the Experts™
on
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.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
ste5anSenior Developer

Commented:
Check your projects properties first:

Capture.PNG
When you need .NET 2.0 as destination target, then you need to select it there.
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.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial