Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SqlConnection namespace not found

Tags:

c#

.net

I'm building up a website using C#, whenever I try this

SqlConnection con = new SqlConnection ();

I get the error that SqlConnection namespace isn't found, but when I do this

System.Data.SqlClient.SqlConnection con;

it works.

Tried to add reference to System.Data.SqlClient, but couldn't find it the references lists even though System.Data is added assembly in the web.config file.

like image 328
user2962142 Avatar asked Feb 20 '16 13:02

user2962142


1 Answers

First: Ensure you're referencing System.Data not System.Data.SqlClient

Then add

using System.Data.SqlClient;

To your namespaces

like image 118
Aydin Avatar answered Oct 05 '22 06:10

Aydin