我初次学习用Delphi。
我的登录界面的主要代码如下,是按照《Delphi 5数据库开发技术》上的例子来做的:
procedure TfrmLogin.BitBtnOkClick(Sender: TObject);
var
pwdfile:textfile;
pwdstr:string;
times:integer;
begin
if checkbox1.Checked=true then
assignfile(pwdfile,'administrator.cfg')
else assignfile(pwdfile,'student.cfg');
reset(pwdfile);
readln(pwdfile,pwdstr);
closefile(pwdfile);
times:=times+1;
if edtPwd.Text=pwdstr then
begin
if checkbox1.Checked=true then frm6.show
else frm7.show;
end
else
begin
if messageDlg('password is wrong,quit?',mtConfirmation,[mbYes,mbNo],0)=mrYes then
close
else if times<3 then edtPwd.SetFocus
else messageDlg('fatal password error,please quit',mtInformation,[mbOk],0);
Application.Terminate;
end;
end;
可是运行后,delphi给出这样的错误提示;
Project Project1.exe raised exception class EInOutError with message "File not found".Process stopped.Use Step or Run to continue.
意思是我没有那两个.cfg文件。我怎样在那个位置建立这个.cfg文件呢?用Delphi中的过程函数还是自己手工建立?
另外,那个例子中的DataModule窗体是如何创建的?那上面有多个表的数据。而我用Form Wizard来创建DataModule只能是关联一个表。
谢谢你们!
我的登录界面的主要代码如下,是按照《Delphi 5数据库开发技术》上的例子来做的:
procedure TfrmLogin.BitBtnOkClick(Sender: TObject);
var
pwdfile:textfile;
pwdstr:string;
times:integer;
begin
if checkbox1.Checked=true then
assignfile(pwdfile,'administrator.cfg')
else assignfile(pwdfile,'student.cfg');
reset(pwdfile);
readln(pwdfile,pwdstr);
closefile(pwdfile);
times:=times+1;
if edtPwd.Text=pwdstr then
begin
if checkbox1.Checked=true then frm6.show
else frm7.show;
end
else
begin
if messageDlg('password is wrong,quit?',mtConfirmation,[mbYes,mbNo],0)=mrYes then
close
else if times<3 then edtPwd.SetFocus
else messageDlg('fatal password error,please quit',mtInformation,[mbOk],0);
Application.Terminate;
end;
end;
可是运行后,delphi给出这样的错误提示;
Project Project1.exe raised exception class EInOutError with message "File not found".Process stopped.Use Step or Run to continue.
意思是我没有那两个.cfg文件。我怎样在那个位置建立这个.cfg文件呢?用Delphi中的过程函数还是自己手工建立?
另外,那个例子中的DataModule窗体是如何创建的?那上面有多个表的数据。而我用Form Wizard来创建DataModule只能是关联一个表。
谢谢你们!
解决方案 »
- 问图片浏览,和图片格式转换的问题,谢谢大家
- midas 的初级问题?(新手)
- 还是关于label设置的问题
- 关于ToolBar的问题。
- 模糊查询问题 在线等待
- 请问form的close和release有什么区别?
- ■■■■■ Install shield打包 ■■■■■■
- 添加保存大于1M的blob字段数据时总出现:invalid blob length 错误信息(我用的:delphi5 +sql2000),而改用ADO保存则没有任何错误
- 如何做像“金山快译”那样的窗体?跑到屏幕最上面,鼠标一指就出来!?thanks
- 难道没高手了吗?
- 关于delphi得一个小问题,请大侠指点,小生非常急用,已经调试了很久了,就是没成功。
- intraweb中iwlink的使用
没写明文件路径
begin
if messageDlg('password is wrong,quit?',mtConfirmation,[mbYes,mbNo],0)=mrYes then
close
else if times<3 then edtPwd.SetFocus
else messageDlg('fatal password error,please quit',mtInformation,[mbOk],0);请仁兄们再帮着看看,好吗?同时我运行时候发现上面的这段代码有问题。