procedure TForm1.FormCreate(Sender: TObject);
var
Strs: TStrings;
begin
Strs := TStringList.Create;
try
with Strs do
begin
Add('String'' 1');
Add('String" 2');
Add('String 3');
QuoteChar := '''';
Delimiter := ',';
end;
with Memo1.Lines do
begin
Clear;
Values['CommaText'] := Strs.CommaText;
Add('SQL Strings');
Add('INSERT INTO TABLE1 (FIELD1, FIELD2, FIELD3)');
Add('VALUES (' + Strs.DelimitedText + ')');
end;
finally
Strs.Free;
end;
end;
{
CommaText="String' 1","String"" 2","String 3"
SQL Strings
INSERT INTO TABLE1 (FIELD1, FIELD2, FIELD3)
VALUES ('String'' 1','String" 2','String 3')
}
沒有留言:
張貼留言