Question : Access Violation Error using GetTableNames

Hello fellow programmers,
I can't seem to get the following code to work. I keep getting Access Violation errors when I try to use the GetTableNames function. I saw another person who had the same error and the response was to set the program to use dbexpmysql.dll instead of dbexpmys.dll, but I have both dlls in my Delphi7\Bin folder and I set my project Search Path to that folder. Any ideas?

var
  MyConnection: TADOConnection;
  TableList : TStrings;
begin
  // I have code here that opens MyConnection, and I know it works, because I have used MyConnection to run queries.
  TableList := nil;
  MyConnection.GetTableNames(TableList, False);
  NumTables := TableList.Count;

Thanks in advance,
MTprogrammerGirl

Answer : Access Violation Error using GetTableNames

try this:

var
  MyConnection: TADOConnection;
  TableList : TStrings;
begin
  TableList := TStringList.Create;
  MyConnection.GetTableNames(TableList, False);
  NumTables := TableList.Count;


ziolko.
Random Solutions  
 
programming4us programming4us