在SQL Server中建立TEST表,两个字段,id varchar(10),photo image(16); procedure TForm1.BitBtn1Click(Sender: TObject); begin openpicturedialog1.execute; image1.picture.loadfromfile(openpicturedialog1.filename); end;procedure TForm1.BitBtn2Click(Sender: TObject); var graphic1:Timage; begin graphic1:=Timage.Create(self); graphic1.picture.loadfromfile(openpicturedialog1.filename); table1.Open; table1.insert; table1.fieldbyname('id').asstring:='121'; table1.fields[1].assign(graphic1.Picture); table1.post; table1.close; graphic1.free; end;
不错,我的可以存取图片,也可以存取.EXE文件,所以我过把.EXE放在 SQL SERVER 上,做了一个在线升级的模块,不过不知道怎么加进度条
代码如下 // showmessage(ver_sql_tmp+'----'+ver_ini_tmp); if strtoint(trim(ver_sql_tmp))>strtoint(trim(ver_ini_tmp)) then//如果有新版本 begin if MessageBox(Handle,pchar('文件原版为 ['+trim(i_version_ini)+'] ,发现新版本程序 ['+trim(g_version_sql)+'] ,是否开始自动升级?'),'系统提示',MB_YESNO OR MB_ICONQUESTION or MB_DEFBUTTON2)=IDYES then begin application.ShowMainForm:=true; with adoquery_ZXSJ do begin close;sql.Clear; sql.Add('select * from ZXSJ'); open; TBlobField(FieldByName('filestream_ZXSJ')).SaveToFile(fieldbyname('appname_zxsj').AsString); myini.WriteString('system','version',g_version_sql);//将新版本号写入ini MessageBox(Handle,pchar('软件升级完成!'),'信息',MB_ICONINFORMATION); winexec(pchar(ExtractFilePath(Application.ExeName)+i_exename),SW_SHOWNORMAL); application.ShowMainForm:=false; application.Terminate; end; end else//不升级 begin winexec(pchar(ExtractFilePath(Application.ExeName)+i_exename),SW_SHOW); application.Terminate; end; end else//软件无新版本 begin winexec(pchar(ExtractFilePath(Application.ExeName)+i_exename),SW_SHOWNORMAL); application.Terminate; // MessageBox(Handle,pchar('软件无新版本!'),'信息',MB_ICONINFORMATION); end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
openpicturedialog1.execute;
image1.picture.loadfromfile(openpicturedialog1.filename);
end;procedure TForm1.BitBtn2Click(Sender: TObject);
var
graphic1:Timage;
begin
graphic1:=Timage.Create(self);
graphic1.picture.loadfromfile(openpicturedialog1.filename);
table1.Open;
table1.insert;
table1.fieldbyname('id').asstring:='121';
table1.fields[1].assign(graphic1.Picture);
table1.post;
table1.close;
graphic1.free;
end;
// showmessage(ver_sql_tmp+'----'+ver_ini_tmp);
if strtoint(trim(ver_sql_tmp))>strtoint(trim(ver_ini_tmp)) then//如果有新版本
begin
if MessageBox(Handle,pchar('文件原版为 ['+trim(i_version_ini)+'] ,发现新版本程序 ['+trim(g_version_sql)+'] ,是否开始自动升级?'),'系统提示',MB_YESNO OR MB_ICONQUESTION or MB_DEFBUTTON2)=IDYES then
begin
application.ShowMainForm:=true;
with adoquery_ZXSJ do
begin
close;sql.Clear;
sql.Add('select * from ZXSJ');
open;
TBlobField(FieldByName('filestream_ZXSJ')).SaveToFile(fieldbyname('appname_zxsj').AsString); myini.WriteString('system','version',g_version_sql);//将新版本号写入ini MessageBox(Handle,pchar('软件升级完成!'),'信息',MB_ICONINFORMATION);
winexec(pchar(ExtractFilePath(Application.ExeName)+i_exename),SW_SHOWNORMAL);
application.ShowMainForm:=false;
application.Terminate;
end;
end
else//不升级
begin
winexec(pchar(ExtractFilePath(Application.ExeName)+i_exename),SW_SHOW);
application.Terminate;
end;
end
else//软件无新版本
begin
winexec(pchar(ExtractFilePath(Application.ExeName)+i_exename),SW_SHOWNORMAL);
application.Terminate;
// MessageBox(Handle,pchar('软件无新版本!'),'信息',MB_ICONINFORMATION);
end;
有人能回答这个问题吗?