I have a error regarding ADOX and i have no idea how to solve.
enter code here public static string[] GetTableExcel(string strFileName)
{
string[] strTables = new string[100];
Catalog sCatalog = new Catalog();
ADOX.Table sTable = new ADOX.Table();
MySql.Data.MySqlClient.MySqlConnection sConn = new MySql.Data.MySqlClient.MySqlConnection();
sConn.Open("server=localhost; Data Source = " + strFileName + ";user id=root;Password=1;database=test;persist security info=False");
sCatalog.ActiveConnection = sConn;
if (sCatalog.Tables.Count > 0)
{
int item = 0;
foreach (ADOX.Table tab in sCatalog.Tables)
{
if (tab.Type == "TABLE")
{
strTables[item] = tab.Name;
item++;
}
}
}
return strTables;
The error stated is that 'No overload for method 'Open' takes one argument. Any kind souls here can help me out? Thanks
MySql.Data.MySqlClient.MySqlConnection.Open(string connStr) is not available, you should call
MySql.Data.MySqlClient.MySqlConnection sConn = new MySql.Data.MySqlClient.MySqlConnection("server=localhost; Data Source = " + strFileName + ";user id=root;Password=1;database=test;persist security info=False");
sConn.Open();