Fejl ved Try Catch
Jeg får en fejl ved min Try / Catch funktionTry
Dim SQLCon As String = ConfigurationManager.AppSettings["OpenCalender"]
Dim query As String = "INSERT INTO Aktivitet (Dato, Bemaerkning) VALUES ('" & TextBox1.Text & "', '" & TextBox2.Text & "')"
Dim MyCon As SqlConnection = New SqlConnection(SQLCon)
MyCon.Open()
Dim cmd As SqlCommand = New SqlCommand(query, MyCon)
Dim rd As SqlDataReader = cmd.ExecuteReader()
rd.Close()
MyCon.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
Jeg får at vide: "SQLCon is not declared"
Hvad kan det skyldes ?