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