How to use the “Using” statement in ASP.net razor webpages?
At the top of your Razor View just add Notice the @ char before the using statement. Or inside a block like below: Side note: it’s a little bit weird to use a SqlConnection into a Razor View.