Hi guys

The just of what i whant to do is read lines of text from a file until it reaches
a delimiter and then execute that text in a query and repeat the process till
there is no more text. I am using Delphi 6(don't have a choice) and the text is SQL in a .txt file

The code I provided does not work because it doesn't use the delimiter(defaults to whitespace)
and a stringlist is not compatable.

If anyone has any advice let me know
Great thanks in advance
R.

sqlRead := TStringList.Create;
  sqlRead.Delimiter := '|';
  sqlRead.LoadFromFile('C:\Users\charll\Desktop\tables.txt');

  for i := 0 to sqlRead.Count-1 do
  begin
  ShowMessage((sqlRead[i]));
  CDSADOQuery1.SQL.Clear;
  CDSADOQuery1.SQL.Text := sqlRead;
  CDSADOQuery1.ExecSQL;
  CDSADOQuery1.Active := True;
  end;

I don't think I have that setting, I'm using delphi 6 and read in another source that it doesn't exist yet in Delphi 6.

Found a comment that in older versions the space is always used as delimiter, so perhaps this is the case here. You may have to parse the file yourself, to get it right. If you are sure that the pipe character is not used in your data, you can use Pos(), Copy() and Delete() to get your queries.

Thanks for the replies but managed it with the next code although it is faulty due toe the fact that if the one table exists it doesn't create the next one but works at least.

qryMain.SQL.LoadFromFile(lsLocation+'\tables.txt');
      qryMain.ExecSQL;
      qryMain.SQL.Clear;

lsLocation is a string that gets the current directory (The location of the .exe file) where the text file is