Unanswered: Drop a tab Sheet from an Excel worksheet with ADO
First: sorry for my English.
I was filled an Excel worksheet with OLEDB (ADO). I first open an Empty worksheet with a single sheet. Then I create an other sheet with the command "CREATE TABLE...". Then I fill the new table (sheet) by multiple command "INSERT INTO". Tha'ts all OK.
Of course I cannot create
But I cannot delete the original sheet with a command "DROP TABLE". I first ask for the tables that shuch database has, but when I execute the command "DROP TABLE Sheet1" (for example) the interfase respond: "The table does not exists".
The code I wrote (Delphi) is:
List := TStringList.Create;
for i := 0 to List.Count - 1 do begin
if (Trim(List[i]) <> MySheetName) then
ComandADO.CommandText := 'DROP TABLE [' +
StringReplace(Trim(List[i]), '$', '', [rfReplaceAll]) + ']';
I tried without the "[", "]" and does not work.
I also try with a simple ADOQUERY, but the result is the same.