Discussion:
Problem with TSQLConnection GetTableNames
(too old to reply)
Eduardo Jauch
2008-03-14 16:59:22 UTC
Permalink
Hi,

On Help, GetTablesName is show like:

procedure GetTableNames(List: TWideStrings; SchemaName: WideString; SystemTables: Boolean = False); overload;

procedure GetTableNames(List: TWideStrings; SystemTables: Boolean = False); overload;


But these only work if I use TStringList. If I try to use TWideStrins, the compiler pop an error that says that there's no overloaded function with the specified parameters...

If I pass the mouse over the name GetTableNames on the IDE, it show me that are FOUR overloaded functions, two using TWideStrings and two using TStrings (that I have to use TStringList obviously)

I'm Using Delphi 2007

What am I doing wrong?
Is some kind of bug?

Thanks!
Eduardo Jauch
2008-03-15 01:49:26 UTC
Permalink
Now I have another problem...

On Windows Vista, GetTableNames don't work at all (On XP worked with
TStringList)...

The strings (TStringList ) theat I pass is always empty...

My code:

procedure
TDataLink.PopulateTableNames;
begin
if FSQLConnection.Connected then //TSQLConnection
{Load table names to FTableNames only if database connected}
FSQLConnection.GetTableNames(FTableNames);
else
begin
FTableNames.Clear; //TStringList
FFieldNames.Clear; //TObjectList
end;
end;
Eduardo Jauch
2008-03-15 02:26:21 UTC
Permalink
I change the way I am using GetTableNames, passing the 'schema' (dbo)
and then work...
Jan Doggen
2008-03-18 22:07:31 UTC
Permalink
I change the way I am using GetTableNames, passing the 'schema' (dbo) and
then work...
That is correct:

{ Use the overloaded function of GetTableNames for MS SQL: }
IF INIDataDbType = dbMSSQL THEN
SQLConnectionData.GetTableNames(TList,'dbo',FALSE)
ELSE
SQLConnectionData.GetTableNames(TList,FALSE);

Maybe for other database types too
This is a known bug
http://tinyurl.com/38te2n

Bye
JAn
Eduardo Jauch
2008-03-20 12:56:57 UTC
Permalink
Thanks Jan.

Good to know it.

Loading...