CharlieDev
asked on
c#, asp.net- using linq in .net 2.0
Hi,
I am trying to code in .net 2.0 when I'm used to .net 3.0
I have linked the LinqBridge.dll but I'm still having troubles with establishing a link between my database and tha aspx code
I have the error: System.NullReferenceExcept ion: Object reference not set to an instance of an object.
for line:
conn = new SqlConnection(Configuratio nManager.C onnectionS trings["st d"].Connec tionString );
Should I still have the namespace using System.Linq; or something else now that i have the LinqBridge.dll?
Many thanks
I am trying to code in .net 2.0 when I'm used to .net 3.0
I have linked the LinqBridge.dll but I'm still having troubles with establishing a link between my database and tha aspx code
I have the error: System.NullReferenceExcept
for line:
conn = new SqlConnection(Configuratio
Should I still have the namespace using System.Linq; or something else now that i have the LinqBridge.dll?
Many thanks
public class DBConnect
{
public static SqlConnection conn = null;
public static void OpenConnection()
{
DBConnect.CloseConnection();
if (conn == null)
{
conn = new SqlConnection(ConfigurationManager.ConnectionStrings["std"].ConnectionString);
}
conn.Open();
}
public static void CloseConnection()
{
if (conn != null)
conn.Close();
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
> Thanks, In my haste I hadnt set up the connection to the DB in the webconfig!!!
no problem, glad you found it now ;-)
no problem, glad you found it now ;-)
ASKER