กำลังทดสอบอยุ่เหมือนกัน ขอ code บ้างครับ
ตัว import code sql แต่ยังทำไม่สำเร็จ LOAD DATA LOCAL INFILE 'C:\\My path\\file.dat' REPLACE INTO TABLE mydb.mytable FIELDS TERMINATED BY ','ENCLOSED BY '"' ESCAPED BY '\\'LINES TERMINATED BY '\r\n';
//code delphi
procedure TFimport43.RzButton1Click(Sender: TObject);
var
archiver : TZipForge;
begin
// Create an instance of the TZipForge class
archiver := TZipForge.Create(nil);
try
with archiver do
begin
// The name of the ZIP file to unzip
FileName := 'C:\test.zip';
// Open an existing archive
OpenArchive(fmOpenRead);
// Set base (default) directory for all archive operations
BaseDir := 'C:\temp';
// Extract all files from the archive to C:\Temp folder
ExtractFiles('*.*');
CloseArchive();
end;
except
on E: Exception do
begin
Writeln('Exception: ', E.Message);
// Wait for the key to be pressed
Readln;
end;
end;
end;
procedure TFimport43.RzButton2Click(Sender: TObject);
var
myFile : TextFile;
text : string;
begin
// Try to open the Test.txt file for writing to
AssignFile(myFile, 'Test.txt');
ReWrite(myFile);
// Write a couple of well known words to this file
WriteLn(myFile, 'Hello World');
// Close the file
CloseFile(myFile);
// Reopen the file for reading
Reset(myFile);
// Display the file contents
while not Eof(myFile) do
begin
ReadLn(myFile, text);
ShowMessage(text);
end;
// Close the file for the last time
CloseFile(myFile);
end;
procedure TFimport43.RzButton4Click(Sender: TObject);
begin
with q41service do
begin
Active:=False;
SQL.Clear;
SQL.Add('Select * from service');
Active:=True;
end;
end;
procedure TFimport43.SpeedButton1Click(Sender: TObject);
var
txt:TextFile;
quebra:TStringList;
arq:string;
begin
quebra := TStringList.Create;
AssignFile(txt,RzEdit1.Text);
Reset(txt);
ProgressBar1.Position:=0;
ProgressBar1.Max:=FileSize(txt);
while not eoln(txt) do
begin
quebra.Clear;
Readln(txt,arq);
ExtractStrings(['|'],[],pChar(arq),quebra);
with q41service do
begin
q41service.SQL.Clear;
q41service.SQL.Add('insert into temp_service(pcucode,pid,seq) values ('+
#34+quebra.Strings[0] +#34+','+
#34+quebra.Strings[1] +#34+','+
#34+quebra.Strings[2] +#34+')');
ExecSQL;
end;
ProgressBar1.Position:=ProgressBar1.Position+1;
end;
CloseFile(txt);
ProgressBar1.Position:=0;
quebra.Free;
ShowMessage('นำเข้าเรียบร้อย');
end;
procedure TFimport43.SpeedButton2Click(Sender: TObject);
begin
if OpenDialog1.Execute then
begin
RzEdit1.Text:=OpenDialog1.FileName;
end;
end;