Page 1 of 1

MySQLDataTable connection

Posted: Wed 09 Jul 2008 13:27
by chern.ivan
Greetings,

I've ran into a problem and I can't seem to find enough info on the topic.

Here is the code snipet

Dim myTableName as String = Test

Dim connectionString = "User=userID; Password=password;Host=123.456.789.123;Database=database;"

Dim dataTable as New MySqlDataTable("Select * FROM & myTableName, connectionString)

try
dataTable.Active = true
msgbox("connected")
catch ex as Exception
msgbox("could not establish connection" & ex.message)
end try


This code loops through a list of datatables. At some point I get an exeption saying lost connection to mySql server.

Question is this: When does a connection to mySql server gets established - when I dimention the dataTable with my connection string, or when I say dataTable.active = true?

From what I see in the help, dataTable.active allows datatable to get populated with data from the data source. it doesnt say anything about the connection being activated.

Posted: Mon 14 Jul 2008 14:22
by AndreyR
Hello, Ivan.

The connection is not opened when you dimension the MySqlDataTable component.
When you set Active property to true, the connection is opened and the datatable is populated with values.

Regards, Andrey.