各位老师好。
我前台开发语言是delphi6.0,后台数据库为Sql Server2000。我的image类型的字段中储存的既有bmp格式的图像,也有jpeg格式的图像。我怎样判断从表中取出来的是bmp格式的图像 还是jpeg格式的图像。代码如下,
procedure TForm1.Button2Click(Sender: TObject);
var
mjp1:tjpegimage;
mbp1:tbitmap;
tms:tmemorystream;
begin
adoquery1.Close;
adoquery1.SQL.Clear ;
adoquery1.SQL.Text:='select * from mao1 where hao=''1111''';
adoquery1.Prepared :=true;
adoquery1.Open ;
adoquery1.Last;
((adoquery1.FieldByName('tuxiang')) as tblobfield).SaveToFile('c:\w22.jpg');
//如果是jpge格式的图像,先保存在c:\w22.jpg文件夹中。 // ((adoquery1.FieldByName('tuxiang')) as tblobfield).SaveToFile('c:\w22.bmp');
//如果是bmp格式的图像,先保存在c:\w22.bmp文件夹中。 image1.Picture.LoadFromFile('c:\w22.jpg'); //显示jpge格式的图像
// image1.Picture.Bitmap.LoadFromFile('c:\222.bmp'); //显示bmp格式的图像
end;
end;
我前台开发语言是delphi6.0,后台数据库为Sql Server2000。我的image类型的字段中储存的既有bmp格式的图像,也有jpeg格式的图像。我怎样判断从表中取出来的是bmp格式的图像 还是jpeg格式的图像。代码如下,
procedure TForm1.Button2Click(Sender: TObject);
var
mjp1:tjpegimage;
mbp1:tbitmap;
tms:tmemorystream;
begin
adoquery1.Close;
adoquery1.SQL.Clear ;
adoquery1.SQL.Text:='select * from mao1 where hao=''1111''';
adoquery1.Prepared :=true;
adoquery1.Open ;
adoquery1.Last;
((adoquery1.FieldByName('tuxiang')) as tblobfield).SaveToFile('c:\w22.jpg');
//如果是jpge格式的图像,先保存在c:\w22.jpg文件夹中。 // ((adoquery1.FieldByName('tuxiang')) as tblobfield).SaveToFile('c:\w22.bmp');
//如果是bmp格式的图像,先保存在c:\w22.bmp文件夹中。 image1.Picture.LoadFromFile('c:\w22.jpg'); //显示jpge格式的图像
// image1.Picture.Bitmap.LoadFromFile('c:\222.bmp'); //显示bmp格式的图像
end;
end;
"BM"为Bitmap格式,否则为jpg