现在在combobox3中输入一个学生的学号码,要在原来学生表中进行查找验证是否存在,用下列语句:
if not locate('sno',vararrayof([combobox3.Text],[lopartialkey]) then
begin
showmessage('不存在此学生!');
exit;
end;
可是编译的时候不能通过,错误的信息是:
[Error] dataupdateUnit1.pas(79): Undeclared identifier: 'lopartialkey'
[Error] dataupdateUnit1.pas(79): Incompatible types: 'TLocateOption' and 'Integer'
[Fatal Error] Project1.dpr(9): Could not compile used unit 'dataupdateUnit1.pas'请指教!
if not locate('sno',vararrayof([combobox3.Text],[lopartialkey]) then
begin
showmessage('不存在此学生!');
exit;
end;
可是编译的时候不能通过,错误的信息是:
[Error] dataupdateUnit1.pas(79): Undeclared identifier: 'lopartialkey'
[Error] dataupdateUnit1.pas(79): Incompatible types: 'TLocateOption' and 'Integer'
[Fatal Error] Project1.dpr(9): Could not compile used unit 'dataupdateUnit1.pas'请指教!
把学生号码设为关键字段TRYEXCEPT没问题试试
2 :类型不兼容'TLocateOption' 和 'Integer' 3 :'dataupdateUnit1.pas'这个单元不能通过编绎,就是错误发生在这个单元
如果一、二两个错误解决了第三个也就解决了。
第二个参数差了个括号!
你的程序应该改为:
if not locate('sno',vararrayof([combobox3.Text]),[lopartialkey]) then
begin
showmessage('不存在此学生!');
exit;
end;
我要做的是:在中combobox中输入一个学号,然后在学生表student.db的字段 sno中查找是否存在
如果存在,就showmessage('存在!'); 否则就showmessage('不存在!');