Created
October 26, 2022 05:35
-
-
Save MySohoWiki/2ae050b78b5ee5899a7157cf8f9ddde7 to your computer and use it in GitHub Desktop.
Use File Stream
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
procedure textXML; | |
var | |
fs: tfilestream; | |
s: string; | |
r: variant; | |
begin | |
//TEST table is "create table _testXML(id int identity not null primary key, data varchar(max), datXML XML)" | |
// | |
//upload xml file to server | |
fs:= tfilestream.create('D:\demo\delphi\Synapse https\test1\sendInvoice.xml',fmOpenRead); | |
try | |
fs.read(s, fs.size); | |
r:= prg.QueryValues('INSERT INTO _testXML(data,datXml) OUTPUT Inserted.ID VALUES(:1,:2)', [s,s]); | |
//showmessage(r); | |
finally | |
fs.free; | |
end; | |
//Get an XML from server and save to file | |
fs:= tfilestream.create('D:\demo\delphi\xxx.xml',fmCreate); | |
try | |
r:= prg.QueryValues('select datXML from _testXML where id=:1', r); | |
fs.write(r, length(r)); | |
finally | |
fs.free; | |
end; | |
end; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment