I have the connection string info in the app.config file. Here is the connection code. If you have any suggestions, please let me know. I come from a C#/VB .net background and I am teaching myself the .net cobol so this code is just for practice purposes. I took Cobol classes in 1984 so I am somewhat familiar with the older standard Cobol syntax.
method-id btnSubmit_Click final private (sender as object e as type System.EventArgs).
Try
perform using connstring as type MySqlConnection = new MySqlConnection(type ConfigurationManager::ConnectionStrings["conn"]::ConnectionString)
perform using da as type MySqlDataAdapter = new MySqlDataAdapter("LoginUser", connstring)
set da::SelectCommand::CommandType = type CommandType::StoredProcedure
invoke connstring::Open()
declare t = new DataTable()
invoke da::Fill(t)
set dataGridView1::DataSource = t
end-perform
end-perform
Catch myex as type MySqlException
set str to str::Append("Source " & myex::Source)
set str to str::Append("Number " & myex::StackTrace)
set str to str::Append("Line Number " & myex::TargetSite)
set str to str::Append("Data Exception " & myex::GetType::ToString)
invoke type Debug::WriteLine(str)
End-Try
So when I use the exception type MySqlException, the code will break at the first perform using with the "object not set..." error. This error does seem to be legitimate as I wrote this same code using C# and got the same results. My question is why does it fall through to the Catch statement when the exception is MySqlException?