我是个外行,所以大家就不要指责我了,帮我改一下错就谢之不尽了.
源码
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'
源码
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'
解决方案 »
- Delphi7怎么设置权限。即是:有一个登录窗体,不同的用户登录之后,在主窗体中有不同的操作权限
- teechart 用选中状态(小方块)表示出选中的曲线 ??
- 求助!!!SimpleDataSet在查询之后就不能再添加数据了?奇怪。
- 如何在delphi里备份还原数据库
- 使用idudpserver和idudpclient编写的程序出现奇怪问题,请高手指点
- FieldByName('Err').AsInteger为什么会把负数转换为正数?
- 如何在delphi中调用dos命令,比如telnet
- 有一个退出程序问题!
- 最后两个问题没解决,饭碗还悬在空中?
- 异常错误,怎么过滤,大家救救火啊
- 如何改变form的caption所用的fontname?
- 一个小程序,大家看看错在那里,有源代码.
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.
[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'
http://download.csdn.net/source/148211
Parameters.ParamByName('姓名').value := edit1.text; 变成一句,我的习惯是: sql.text:= 'select *from 2009 where 姓名 like ''%'+trim(edit1.text)+'%''';