Z
zhangxuepu107
Unregistered / Unconfirmed
GUEST, unregistred user!
把我本地的word文件保存到服务器的数据库中,然后还要在客户端打开这个word文件
打开的时候是乱码?不知是什么原因
写入:
if OpenDialog1.Execute then
begin
if OpenDialog1.FileName ='' then
exit;
with ds do
begin
close;
commandtext:='select * from cc';
open;
end;
ds.insert;
fs:=TFileStream.Create(OpenDialog1.FileName,fmOpenRead);
fs.Seek(0,0);
//ds.FieldByName('htnum').asstring:=edit2.text;
TBlobField(ds.FieldByName('htyj')).LoadFromStream(fs);
ds.Post;
ds.Close;
fs.Free;
showmessage('ok');
end;
读出:
with tongyong do
begin
if active then
active:=false;
sql.clear;
sql.add('select * from cc ');
active:=true;
fs:=TAdoBlobStream.Create(TBlobField(FieldbyName('htyj')),bmRead);//将信息读出同时写到流中
fn:='temp_word.doc';
fs.SaveToFile(fn);
//保存为文件
ShellExecute(0, 'open', PChar(fn), nil, nil, SW_SHOW);//打开
end;
请指点,急急急!!!!!! qq:85277206
打开的时候是乱码?不知是什么原因
写入:
if OpenDialog1.Execute then
begin
if OpenDialog1.FileName ='' then
exit;
with ds do
begin
close;
commandtext:='select * from cc';
open;
end;
ds.insert;
fs:=TFileStream.Create(OpenDialog1.FileName,fmOpenRead);
fs.Seek(0,0);
//ds.FieldByName('htnum').asstring:=edit2.text;
TBlobField(ds.FieldByName('htyj')).LoadFromStream(fs);
ds.Post;
ds.Close;
fs.Free;
showmessage('ok');
end;
读出:
with tongyong do
begin
if active then
active:=false;
sql.clear;
sql.add('select * from cc ');
active:=true;
fs:=TAdoBlobStream.Create(TBlobField(FieldbyName('htyj')),bmRead);//将信息读出同时写到流中
fn:='temp_word.doc';
fs.SaveToFile(fn);
//保存为文件
ShellExecute(0, 'open', PChar(fn), nil, nil, SW_SHOW);//打开
end;
请指点,急急急!!!!!! qq:85277206