我是个外行,所以大家就不要指责我了,帮我改一下错就谢之不尽了.
源码
unit Unit1;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DB, ADODB, StdCtrls, Buttons, ExtCtrls,jpeg;type
  TForm1 = class(TForm)
    Image1: TImage;
    BitBtn1: TBitBtn;
    Edit1: TEdit;
    ADOQuery1: TADOQuery;
    procedure BitBtn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;var
  Form1: TForm1;implementation{$R *.dfm}procedure TForm1.BitBtn1Click(Sender: TObject);
  var
  mStream: TMemoryStream;
  JpgFile: TjpegImage;
  bmpfile: Tbitmap;
begin
   try
   with adoquery1 do
        begin
        close;
        sql.Clear;
        sql.Add('select *from 2009 where 姓名like:姓名');
        Parameters.ParamByName('姓名').value := edit1.text;
        open;
     begin
     mstream:=tmemorystream.Create;
     jpgfile:=tjpegimage.Create;
     bmpfile:=tbitmap.Create;
     Tblobfield(adoquery1.FieldByName('touxiang')).SaveToStream(mstream);
     mstream.Position:=0;
     if (adoquery1.FieldValues['extm'] = '.jpeg') then
         begin
         mstream.Position:=0;
         jpgfile.LoadFromStream(mstream);
         image1.Picture.Assign(jpgfile);
         end;
      if (adoquery1.FieldValues['extm'] = '.bmp') then
         begin
         mstream.Position:=0;
         bmpfile.LoadFromStream(mstream);
         image1.Picture.Assign(bmpfile);
     end
     else
         image1.Picture:=nil;
   finally
   jpgfile.Free;
   bmpfile.Free;
end;
end.
这下面的是错误的提示
[Error] Unit1.pas(65): 'END' expected but 'FINALLY' found
[Error] Unit1.pas(70): EXCEPT or FINALLY expected
[Error] Unit1.pas(72): ';' expected but end of file found
[Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'

解决方案 »

  1.   

    unit Unit1; interface uses 
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 
      Dialogs, DB, ADODB, StdCtrls, Buttons, ExtCtrls,jpeg; type 
      TForm1 = class(TForm) 
        Image1: TImage; 
        BitBtn1: TBitBtn; 
        Edit1: TEdit; 
        ADOQuery1: TADOQuery; 
        procedure BitBtn1Click(Sender: TObject); 
      private 
        { Private declarations } 
      public 
        { Public declarations } 
      end; var 
      Form1: TForm1; implementation {$R *.dfm} procedure TForm1.BitBtn1Click(Sender: TObject); 
      var 
      mStream: TMemoryStream; 
      JpgFile: TjpegImage; 
      bmpfile: Tbitmap; 
    begin 
      try 
      with adoquery1 do 
            begin 
            close; 
            sql.Clear; 
            sql.Add('select *from 2009 where 姓名like:姓名'); 
            Parameters.ParamByName('姓名').value := edit1.text; 
            open; 
      end;      // <- add
    //    begin   // <-del
        mstream:=tmemorystream.Create; 
        jpgfile:=tjpegimage.Create; 
        bmpfile:=tbitmap.Create; 
        Tblobfield(adoquery1.FieldByName('touxiang')).SaveToStream(mstream); 
        mstream.Position:=0; 
        if (adoquery1.FieldValues['extm'] = '.jpeg') then 
            begin 
            mstream.Position:=0; 
            jpgfile.LoadFromStream(mstream); 
            image1.Picture.Assign(jpgfile); 
            end; 
          if (adoquery1.FieldValues['extm'] = '.bmp') then 
            begin 
            mstream.Position:=0; 
            bmpfile.LoadFromStream(mstream); 
            image1.Picture.Assign(bmpfile); 
        end 
        else 
            image1.Picture:=nil; 
      finally 
      jpgfile.Free; 
      bmpfile.Free; 
      end;       // <- add
    end; 
    end. 
      

  2.   

    尊照你的指导,错误提示又变成这下面这个东西了,再帮忙看看
    [Error] Unit1.pas(64): 'END' expected but 'FINALLY' found
    [Error] Unit1.pas(67): EXCEPT or FINALLY expected
    [Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'
      

  3.   

    去这个地址,下载个DELPHI错误说明,看看也许有用
    http://download.csdn.net/source/148211
      

  4.   

            sql.Add('select *from 2009 where 姓名like:姓名');   // 姓名like 之间没有空格
            Parameters.ParamByName('姓名').value := edit1.text; 变成一句,我的习惯是:        sql.text:= 'select *from 2009 where 姓名 like ''%'+trim(edit1.text)+'%'''; 
      

  5.   

    变成 sql.text:= 'select * from 2009 where 姓名 like ''%'+trim(edit1.text)+'%'''; btw 2009 是表名??
      

  6.   

    语法错 with...end 不配套
      

  7.   

    谢谢朋友们的帮助,看来我连DELPHI的门都没入啊.