At the top of your Razor View just add
@using System.Data.SqlClient
Notice the @
char before the using statement.
Or inside a block like below:
@{ using System.Data.SqlClient; }
Side note: it’s a little bit weird to use a SqlConnection
into a Razor View.