How to use the "Use" statement on ASP.net firewall web pages?

Therefore, I need to add the "using" statement:

using System.Data.SqlClient 

on my web page, so I don't need to call Whats inside SqlClient with all the statement

 System.Data.SqlClient.SqlConnection con = new ..

How to do it?

Notice that I added the System.Data link to my webconfig file.

+4
source share
1 answer

At the top of your Razor View, simply add

@using System.Data.SqlClient 

Note the @char before the using statement.


Note: a bit strange to use SqlConnectionin a Razor view.

+6
source

Source: https://habr.com/ru/post/1629703/


All Articles