I’m working on an inline page to display some course information and keep getting a compilation error with the use of ‘var’.
Can you check the following line of code and recommend ideas on fixing it.
//Get basic template details
using (var objConn = new SqlConnection(strConnection))
{
objConn.Open();
My imported namespaces look like as follows.
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.Text" %
Any ideas?
EDIT
Version of .Net on the server – Microsoft .NET Framework Version:2.0
Thanks.
You’ll either need to switch to using C# 3.0 and .NET Framework 3.5, or you’ll need to stop using the
varkeyword and specify the correct type, such as: