We help IT Professionals succeed at work.

Getting an error when trying to connect using the  SqlConnection

cmdolcet
cmdolcet asked
on
83 Views
Last Modified: 2019-01-28
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

ste5anSenior Developer
CERTIFIED EXPERT

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:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION