MySQLDataTable connection

MySQLDataTable connection

Postby chern.ivan » Wed 09 Jul 2008 13:27

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.
chern.ivan
 
Posts: 2
Joined: Wed 09 Jul 2008 13:14

Postby AndreyR » Mon 14 Jul 2008 14:22

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.
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16


Return to dotConnect for MySQL