我用的是delphi7开发一个才c/s结构的一个小系统。由于是初学者,有些问题亟待解决。我用的是remote服务器midas多层应用程序。但我在有运行登录窗体时他报错:
project server1.exe raised exception class EAccessViolation with message'Access violation at adrress 00575200 in module'server1.exe.Read of address 00000060'.Process stopped.Use Step or Run to continue.
他指向的位置是
procedure TfrmLogin.btnOkClick(Sender: TObject);
var
username, password: string;
begin
username := edtusername.Text;
password := edtpassword.Text;
try
dmclient.cdsLogin.Active := false;
{dmclient.cdsLogin.CommandText:='select *from systemusers'+
'where username:=username and password=:password';}
//向应用服务器传递参数值,以便进行查询
dmclient.cdsLogin.Params.ParamByName('username').Value := username;
dmclient.cdsLogin.Params.ParamByName('password').Value := password;
dmclient.cdsLogin.Open;
//查到唯一用户
if dmclient.cdsLogin.RecordCount=1 then
begin
//取得用户权限
formMain.authorization:= dmclient.cdsLogin.fieldbyname('authorization').Value;
flag := true;
close;
end
else
begin
flag:=false;
messagedlg('用户验证失败', mterror, [mbok], 0);
exit;
end;
except
on e:exception do
begin
messagedlg('错误:' + e.Message, mterror, [mbok], 0);
exit;
end;
end;
end;
谁能帮我看一下呀,我在线等待,我都搞了两天这个错误了。大哥们救救我呀。
project server1.exe raised exception class EAccessViolation with message'Access violation at adrress 00575200 in module'server1.exe.Read of address 00000060'.Process stopped.Use Step or Run to continue.
他指向的位置是
procedure TfrmLogin.btnOkClick(Sender: TObject);
var
username, password: string;
begin
username := edtusername.Text;
password := edtpassword.Text;
try
dmclient.cdsLogin.Active := false;
{dmclient.cdsLogin.CommandText:='select *from systemusers'+
'where username:=username and password=:password';}
//向应用服务器传递参数值,以便进行查询
dmclient.cdsLogin.Params.ParamByName('username').Value := username;
dmclient.cdsLogin.Params.ParamByName('password').Value := password;
dmclient.cdsLogin.Open;
//查到唯一用户
if dmclient.cdsLogin.RecordCount=1 then
begin
//取得用户权限
formMain.authorization:= dmclient.cdsLogin.fieldbyname('authorization').Value;
flag := true;
close;
end
else
begin
flag:=false;
messagedlg('用户验证失败', mterror, [mbok], 0);
exit;
end;
except
on e:exception do
begin
messagedlg('错误:' + e.Message, mterror, [mbok], 0);
exit;
end;
end;
end;
谁能帮我看一下呀,我在线等待,我都搞了两天这个错误了。大哥们救救我呀。
上面加上dmclient:=Tdmclient.create(Self);
这样不行
clientdataset上面