I am trying to use a connection string from web.config file for the first time. Here is my code.
I am getting The ConnectionString property has not been initialized. What am I doing wrong?VB Code:
Try Dim cmd As String = _ ("SELECT [Name], BirthDate, StartDate From " & _ "Employees WHERE PayGroup='20' AND Status='A'") Dim conn As String = _ System.Configuration. _ ConfigurationManager. _ AppSettings("myConString") Dim myConn As New SqlConnection(conn) Dim myCmd As New SqlDataAdapter(cmd, myConn) Dim ds As New DataSet myCmd.Fill(ds) gvEmp.DataSource = ds gvEmp.DataBind() Catch ex As Exception Response.Write(ex.Message & "<br>") Finally End Try


Reply With Quote
