
DELPHI Locate代码出错!
beginCount:=0;LoginUser:=UserCB.Text;ifLoginUser=''thenShowmessage('请确定用户名!');withDat...
begin
Count:=0;
LoginUser:=UserCB.Text ;
if LoginUser='' then Showmessage('请确定用户名!');
with DataModule1.Table1 do
begin
if Locate('UserName',UserCB.Text ,[loCaseInsensitive]) then
begin
LoginPass:=Trim(Fields[1].AsString );
Inc(Count);
if LoginPass=Trim(PasswordEdit.text) then //程序有错,不能完成调用
Inc(Count)
else
ShowMessage('密码不对!');
end else
ShowMessage('用户不存在!');
if Count=2 then
GuestKind:=Fields[2].AsString
else
begin
if TryCount<3 then
begin
Inc(TryCount);
exit;
end else
Application.Terminate ;
end;
end;
Close;
end;
end;
end.
错误报告:
[错误] U_LoginForm.pas(84): Undeclared identifier: 'loCaseInsensitive'
[错误] U_LoginForm.pas(84): Incompatible types: 'TLocateOption' and 'Integer'
[错误] U_LoginForm.pas(88): Undeclared identifier: 'PasswordEdit'
[错误] U_LoginForm.pas(88): There is no overloaded version of 'Trim' that can be called with these arguments
[致命错误] BookTicket.dpr(8): Could not compile used unit 'U_LoginForm.pas'
请问那里出错了,是按书上篇的。 展开
Count:=0;
LoginUser:=UserCB.Text ;
if LoginUser='' then Showmessage('请确定用户名!');
with DataModule1.Table1 do
begin
if Locate('UserName',UserCB.Text ,[loCaseInsensitive]) then
begin
LoginPass:=Trim(Fields[1].AsString );
Inc(Count);
if LoginPass=Trim(PasswordEdit.text) then //程序有错,不能完成调用
Inc(Count)
else
ShowMessage('密码不对!');
end else
ShowMessage('用户不存在!');
if Count=2 then
GuestKind:=Fields[2].AsString
else
begin
if TryCount<3 then
begin
Inc(TryCount);
exit;
end else
Application.Terminate ;
end;
end;
Close;
end;
end;
end.
错误报告:
[错误] U_LoginForm.pas(84): Undeclared identifier: 'loCaseInsensitive'
[错误] U_LoginForm.pas(84): Incompatible types: 'TLocateOption' and 'Integer'
[错误] U_LoginForm.pas(88): Undeclared identifier: 'PasswordEdit'
[错误] U_LoginForm.pas(88): There is no overloaded version of 'Trim' that can be called with these arguments
[致命错误] BookTicket.dpr(8): Could not compile used unit 'U_LoginForm.pas'
请问那里出错了,是按书上篇的。 展开
2个回答
展开全部
1:loCaseInsensitive需要引用DB。
2:没找到哪句错,你把错误的那句贴出来。
3:你没有PasswordEdit这个东东,看名字应该是一个名字叫PasswordEdit的Edit输入框。
4:应该是有自定义函数与TRIM重名了。
不要什么照书上抄,自己先理解那些代码什么意思
现在世面上就没几本DELPHI的真正好书,90%都是骗钱的!
2:没找到哪句错,你把错误的那句贴出来。
3:你没有PasswordEdit这个东东,看名字应该是一个名字叫PasswordEdit的Edit输入框。
4:应该是有自定义函数与TRIM重名了。
不要什么照书上抄,自己先理解那些代码什么意思
现在世面上就没几本DELPHI的真正好书,90%都是骗钱的!
展开全部
[错误] U_LoginForm.pas(84): Undeclared identifier: 'loCaseInsensitive' //这个变量未声明,可能你有的单元文件没有uses
[错误] U_LoginForm.pas(84): Incompatible types: 'TLocateOption' and 'Integer' //操作数的 数据类型不匹配.
[错误] U_LoginForm.pas(88): Undeclared identifier: 'PasswordEdit'
//同上,未声明变量
[错误] U_LoginForm.pas(88): There is no overloaded version of 'Trim' that can be called with these arguments
//trim函数的参数错了.这个函数只带一个参数
感觉是你没有uses单元.你在看看 你书上这个例子的文件头呐
[错误] U_LoginForm.pas(84): Incompatible types: 'TLocateOption' and 'Integer' //操作数的 数据类型不匹配.
[错误] U_LoginForm.pas(88): Undeclared identifier: 'PasswordEdit'
//同上,未声明变量
[错误] U_LoginForm.pas(88): There is no overloaded version of 'Trim' that can be called with these arguments
//trim函数的参数错了.这个函数只带一个参数
感觉是你没有uses单元.你在看看 你书上这个例子的文件头呐
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询