var
gr1:Timage;
i:integer;
tt:string;
begin
i:=1;
//image1.Picture;
opendialog1.Execute;
tt:=opendialog1.FileName;
image1.Picture.LoadFromFile(tt);
table1.Open;
if inttostr(i)<>table1.FieldByName('id').AsString then
begin
table1.Insert;
table1.FieldByName('id').AsString:=inttostr(i);
table1.FieldByName('photo').Assign(Image1.picture);
i:=i+1;
end;
table1.Post;
table1.Close;
image1.Free;
end;
我用opendialog1.Execute;
tt:=opendialog1.FileName;
image1.Picture.LoadFromFile(tt);這條語句執行總是報無法裝入*.jpg文件
執行以上所有程序無法存入“photo"字段當中。
我的數據庫是sqlserver。圖片是.jpg格式的。
請指教。
gr1:Timage;
i:integer;
tt:string;
begin
i:=1;
//image1.Picture;
opendialog1.Execute;
tt:=opendialog1.FileName;
image1.Picture.LoadFromFile(tt);
table1.Open;
if inttostr(i)<>table1.FieldByName('id').AsString then
begin
table1.Insert;
table1.FieldByName('id').AsString:=inttostr(i);
table1.FieldByName('photo').Assign(Image1.picture);
i:=i+1;
end;
table1.Post;
table1.Close;
image1.Free;
end;
我用opendialog1.Execute;
tt:=opendialog1.FileName;
image1.Picture.LoadFromFile(tt);這條語句執行總是報無法裝入*.jpg文件
執行以上所有程序無法存入“photo"字段當中。
我的數據庫是sqlserver。圖片是.jpg格式的。
請指教。
验证的Acess数据库ole字段
var
st: TStringStream;
Str : String;
Jpeg1 : TJPEGIMAGE;
bmp:TBitmap;
begin
if OpenPictureDialog1.Execute then
begin
bmp:=TBitmap.Create;
Str := ExtractFileExt(OpenPictureDialog1.filename);
Str := Copy(Str,2,3);
if Str='bmp' then
bmp.LoadFromFile(OpenPictureDialog1.FileName)
else if Str='jpg' then //若是jpg转换成bmp保存
begin
Jpeg1 := TJPEGIMAGE.Create;
Jpeg1.LoadFromFile(OpenPictureDialog1.FileName);
bmp.Assign(Jpeg1);
end;
st := tstringstream.create('');产生数据流
bmp.SaveToStream(st);
adoPic1.Edit;
adoPic1.FieldByName('PicData').AsString:= st.datastring;
end;