我的数据库是sql server2000,我的表建立为
create table myfrieds
  (name varchar(15) notnull,
     telephone varchar(12),
     address varchar(30),
     zipvarchar(8),
     picture varchar(15),
     image image);
其中,picture字段用于保存图像的名称(包括路径),image(Graphic字符)则用于存储图像,其数据类型为“image”。
图像保存的处理程序如下:
  procedureTform1.Savebtnclick(sender:TObject);
  var
      graphic1:TGraphic;
  begin
      graphic1:=TGraphic.Create;
   graphic1.loadfromfile(opendialog1.filename);
   table1.insert;
   table1.fieldbyname('name').asstring:=edit1.text;
   table1.fieldbyname('telephon').asstring:=edit2.text;
   table1.fieldbyname('address').asfloat:=edit3.text;
   table1.fieldbyname('zip').asfloat:=edit4.text;
   table1.fields[4].assign(graphic1);
   table1.post;
   graphic1.free;
  end;
可却运行不了,提示
[Warning] Unit3.pas(61): Constructing instance of 'TGraphic' containing abstract methods.
abstract error!!!!!
请高手帮忙!!!!!!!!
为何table1.fields[4].assign(graphic1)而不是fields[5],image字段放什么数据呢?
我把table1.fields[4].assign(graphic1);换成了TBlobField( table1.fields[4] ).loadfromfile(opendialog1.filename);
可还是运行不了,提示同样的错误.
请指教!!!!

解决方案 »

  1.   

    老大
    grphic是一个基类
    其中的好多方法都是虚方法
    不能用的
    可以用它的子类
    timage或其他
      

  2.   

    要用TBlobField( table1.fields[5] ).loadfromfile(opendialog1.filename);picture里只是存路径啊(我也不知道这有什么用),image里存实际的图我后来追发了你没看吗?
      

  3.   

    我现在的程序没有错误提示了,但是数据库里是image字段是空的,其他字段到是有数据,不知为什么?对不起,你追发的我没看见.
      

  4.   

    用loadfromfile应该可以的
    要不你试一下先用imageloadfrom(file)调入该图
    然后用TBlobField( table1.fields[5] ).assign(image)
    试一下吧
    你必须多刷新才可以看得到最新的答复
      

  5.   

    老大,为什么你一定要向picture中加入图像啊,你没有看到啊,那是存放字条符的啊
      

  6.   

    如果你的图片不是.bmp,那么换成.bmp试试??????????
      

  7.   

    用参数试试
    table1.ParamByName('image').LoadFromFile(FileName,ftBlob);  //filename为图片文件名
      
      

  8.   

    你的TTable连ParamByName都有了?Delphi 6新加的?