Hi,
I have a nubie question. I want to store in an app variable my connection string.
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
Application("ConnStr") = "Data Source=dev2;uid=sa;pwd=dev2;database=cunet_db"
End Sub
Then in my public class on the page I want to simply call it with:
Public Class CalendarMain
Dim sqlConn As New SqlConnection(Application("ConnStr"))
BUT I KEEP GETTING AN ERROR:
System.NullReferenceException: Object reference not set to an instance of an object.
I have a nubie question. I want to store in an app variable my connection string.
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
Application("ConnStr") = "Data Source=dev2;uid=sa;pwd=dev2;database=cunet_db"
End Sub
Then in my public class on the page I want to simply call it with:
Public Class CalendarMain
Dim sqlConn As New SqlConnection(Application("ConnStr"))
BUT I KEEP GETTING AN ERROR:
System.NullReferenceException: Object reference not set to an instance of an object.