Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   OOP (https://www.clubdelphi.com/foros/forumdisplay.php?f=5)
-   -   Importar fichero XML (https://www.clubdelphi.com/foros/showthread.php?t=63299)

cincosoft 08-02-2009 09:05:14

Importar fichero XML
 
Hola estoy intentando cargar un fichero XML en una tabla de interbase de la siguiente manera:
if FileExists(Plantilla) then begin
vFichero := TStringList.Create;
vFichero.LoadFromFile(IncludeTrailingBackslash(ExtractFilePath(Application.ExeName)) + Plantilla);
for i:=1 to vFichero.Count - 1 do begin
vsLinea := vFichero.Strings[i];
vsSql := 'INSERT INTO PLANTILLA_XML (ATRIB1) VALUES (''' + vsLinea + ''' )';
qCargaTabla.Close;
qCargaTabla.SQL.Text := vsSql;
qCargaTabla.ExecSQL;
end;//for
vFichero.Clear;
vFichero.Free;
end //if FileExists

Y me da el siguiente error:
Project PtojectXML.exe raised exception class EDBEEngineError with message 'Missing right quote.'. Process stopped. Use Step or Run to continue

¿Alguien podría decirme porfavor porque me pasa y como solucionarlo?

Gracias

RONPABLO 08-02-2009 10:29:58

Prueba con los siguientes combios...

Código Delphi [-]
if FileExists(Plantilla) then begin
  vFichero := TStringList.Create;
  vFichero.LoadFromFile(IncludeTrailingBackslash(ExtractFilePath(Application.ExeName)) + Plantilla);
  for i:=1 to vFichero.Count - 1 do begin
    vsLinea := vFichero.Strings[i];
    vsSql := 'INSERT INTO PLANTILLA_XML (ATRIB1) VALUES (:vsLinea)';
    qCargaTabla.Close;
    qCargaTabla.SQL.Text := vsSql;
qCargaTabla.ParamByName('vsLinea').asString := vsLinea;
    qCargaTabla.ExecSQL;
  end;//for
  vFichero.Clear;
  vFichero.Free;
end //if FileExists


La franja horaria es GMT +2. Ahora son las 21:55:45.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi