注册 登录
编程论坛 Delphi论坛

大家帮我看看问题出在哪里?

lifa 发布于 2005-12-21 23:57, 595 次点击

我用Access 和Delphi连接后,就有代码编程,代码如下:

var
aname,apassword,sqlstr:string;
a:integer;
begin
if (length(trim(name_edit.Text)) > 0) or (length(trim(password_edit.Text)) > 0) then
begin
aname:=trim(name_edit.Text);
apassword:=trim(password_edit.Text);
sqlstr:='select * from 管理者信息 a where (a.用户名称='''+aname+''') and(a.密码='''+apassword+''') ';
with TQuery.Create(nil) do
try
SessionName:=MainWinForm.Table1.SessionName;
DatabaseName:=MainWinForm.Table1.DatabaseName;

     Close;
SQL.Clear;
SQL.Add(sqlstr);
Open;
if RecordCount > 0 then
begin
First;
while not Eof do
begin
a:=strtoint(copy(FieldByName('菜单项').AsString,1,1));

MainWinForm.MainMenu1.Items.Items[a].Visible:=true;

Next;
end;

运行时,语法没错误,就是弹出错误提示:'file'菜单项'not found',到底是怎么回事啊?

2 回复
#2
chen__han12005-12-26 23:32
没有创建菜单项吧,
#3
shadow9162005-12-27 12:12
FieldByName('菜单项')--错误在这里
1