public bool ConnectToDataBase(string strConnect)
{
sqlConnection = new MySqlConnection(strConnect.ToString());
try
{
sqlConnection.Open();
listTables = new List<string>();
using (DataTable dt = sqlConnection.GetSchema("Tables"))
{
if (dt != null && dt.Rows.Count > 0)
{
listTables.Capacity = dt.Rows.Count;
foreach (DataRow row in dt.Rows)
listTables.Add(row["table_name"].ToString());
}
}
sqlConnection.Close();
//string query = "select * from sys.tables where type_desc = 'USER_TABLE'";
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
return false;
}
return true;
}