Hello,
I am developing a vb.net application using a mySql database with
corelabs provider.
I am having a bit of difficulty getting a db connection to work. Here
is my app.exe.config file:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appsettings>
<add key = "ConnectionString" value =
"Database=genesys;userid=daniel;password=*******;h ost=192.168.1.4;" />
</appsettings>
And here is the code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim myCon As MySqlConnection
Dim myCmd As MySqlCommand
Dim strSql As String = ("Select * from pt_info")
myCon = New MySqlConnection
myCon.ConnectionString =
(System.Configuration.ConfigurationSettings.AppSet tings("ConnectionString"))
myCon.Open() <--error here
myCmd = New MySqlCommand(strSql, myCon)
Dim myReader As MySqlDataReader
myReader = myCmd.ExecuteReader()
If myReader.Read Then
Label1.Text = ("Successfull, baby")
End If
End Sub
For some reason, I am getting an ConnectionString property not
initialized error when the form loads. I can't figure out why
Can someone please help???
TIA,
Daniel