论坛: 编程破解 标题: 用delphi做数据库时遇到的问题,请教!!谢了 复制本贴地址    
作者: leoer [leoer]    论坛用户   登录
我在做一个实验,要做一个学生选课查询系统,为了做这个我又专门学的delphi,以为不会太难,可是用起来发现好多问题 ,为了实现按学号来查询学生信息,我在form1中加了个edit1和button1.写的代码如下:
procedure TForm1.Button1Click(Sender: TObject);

begin
dbgrid1.Visible:=true;
  if (edit1.text='') then
  begin showmessage('不输入学号我就罢工!*^_^*');
  abort;
  end;
try
  query1.DisableConstraints;
  query1.Close;
  query1.ParamByName('sno').value:=edit1.Text;
  query1.Open;
  finally
  query1.EnableConstraints;
if query1.FieldByName('sno').Value='' then
begin
showmessage('无此人,请重新查询!');
edit1.clear;
end;
end;

end;


可以运行,可是当在edit1中输入相应学号后查询会出现一个名为“debugger exception notification”的对话框,
内容是:project project1.exe raised exception class edatabaseerror with message'query1;parameter'sno'not found;.process stopped.use step or run to continue.
我想可能是找不到我要查询的名字吧?

请会delphi的指教,我是刚学delphi,越明了越好,先谢了,



地主 发表时间: 04-05-10 16:06

论坛: 编程破解

20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon

粤ICP备05087286号