Get_Role_ApplicationResourceBody_By_ID = 'Select [ApplicationResourceBody] From [Role] where [ID] = :id';
Get_ApplicationUser_UserGroupID = 'Select UserGroupID From ApplicationUser WHERE ApplicationUser.UserName = :UserName And Password = :Password';procedure TSplashForm.PDJXPButton1Click(Sender: TObject);
var
UserGroupId:string;
begin
self.ADOQuery1.Close();
self.ADOQuery1.SQL.Clear();
self.ADOQuery1.SQL.Text := SQLStatements.Get_ApplicationUser_UserGroupID;
self.ADOQuery1.Parameters.ParamValues[ParameterNames.ParamName_ApplicationUser_UserName] := Trim(self.PDJXPEdit1.Text);
self.ADOQuery1.Parameters.ParamValues[ParameterNames.ParamName_ApplicationUser_Password] := EnCodeByMD5.MD5(Trim(self.PDJXPEdit2.Text));
self.ADOQuery1.Open();
if self.ADOQuery1.RecordCount > 0 then
begin
UserGroupId := self.ADOQuery1.FieldByName('UserGroupID').AsString;
Edit1.Text := UserGroupId;
//MainForm.LoginUser.name := Trim(self.PDJXPEdit1.Text);
//MainForm.LoginUser.Role := ;
//MainForm.LoginUser.Password := EnCodeByMD5.MD5(Trim(self.PDJXPEdit2.Text));
self.ADOQuery2.Close();
self.ADOQuery2.SQL.Clear();
self.ADOQuery2.SQL.Text := SQLStatements.Get_Role_ApplicationResourceBody_By_ID;
self.ADOQuery2.Parameters.ParamValues[ParameterNames.ParamName_Identifier] := UserGroupId;
//self.ADOQuery2.Prepared := true;
//self.ADOQuery2.Active := true;
self.ADOQuery2.Open();
self.ADOQuery2.EnableControls();
MainForm.LoginUser.name := Trim(self.PDJXPEdit1.Text);
MainForm.LoginUser.Role := self.ADOQuery2.FieldByName('ApplicationResourceBody').AsString; ///////这里出错!!!!我单步调试,到这里就出错了
MainForm.LoginUser.Password := EnCodeByMD5.MD5(Trim(self.PDJXPEdit2.Text));
Edit1.Text := IntToStr(self.ADOQuery2.RecordCount);
//Application.CreateForm(TMainForm, MainForm);
//self.Close;
end
else
begin
self.suiMessageDialog1.Text := SystemMessage.Login_Error;
self.suiMessageDialog1.ShowModal();
end;
end;错误信息:Project TrainMIS.exe raised exception class EAccessViolation with message 'Access violation at adress 004044c8 in module 'TrainMIS.exe' . write of address 0000033c请问这是咋回事阿?!
Get_ApplicationUser_UserGroupID = 'Select UserGroupID From ApplicationUser WHERE ApplicationUser.UserName = :UserName And Password = :Password';procedure TSplashForm.PDJXPButton1Click(Sender: TObject);
var
UserGroupId:string;
begin
self.ADOQuery1.Close();
self.ADOQuery1.SQL.Clear();
self.ADOQuery1.SQL.Text := SQLStatements.Get_ApplicationUser_UserGroupID;
self.ADOQuery1.Parameters.ParamValues[ParameterNames.ParamName_ApplicationUser_UserName] := Trim(self.PDJXPEdit1.Text);
self.ADOQuery1.Parameters.ParamValues[ParameterNames.ParamName_ApplicationUser_Password] := EnCodeByMD5.MD5(Trim(self.PDJXPEdit2.Text));
self.ADOQuery1.Open();
if self.ADOQuery1.RecordCount > 0 then
begin
UserGroupId := self.ADOQuery1.FieldByName('UserGroupID').AsString;
Edit1.Text := UserGroupId;
//MainForm.LoginUser.name := Trim(self.PDJXPEdit1.Text);
//MainForm.LoginUser.Role := ;
//MainForm.LoginUser.Password := EnCodeByMD5.MD5(Trim(self.PDJXPEdit2.Text));
self.ADOQuery2.Close();
self.ADOQuery2.SQL.Clear();
self.ADOQuery2.SQL.Text := SQLStatements.Get_Role_ApplicationResourceBody_By_ID;
self.ADOQuery2.Parameters.ParamValues[ParameterNames.ParamName_Identifier] := UserGroupId;
//self.ADOQuery2.Prepared := true;
//self.ADOQuery2.Active := true;
self.ADOQuery2.Open();
self.ADOQuery2.EnableControls();
MainForm.LoginUser.name := Trim(self.PDJXPEdit1.Text);
MainForm.LoginUser.Role := self.ADOQuery2.FieldByName('ApplicationResourceBody').AsString; ///////这里出错!!!!我单步调试,到这里就出错了
MainForm.LoginUser.Password := EnCodeByMD5.MD5(Trim(self.PDJXPEdit2.Text));
Edit1.Text := IntToStr(self.ADOQuery2.RecordCount);
//Application.CreateForm(TMainForm, MainForm);
//self.Close;
end
else
begin
self.suiMessageDialog1.Text := SystemMessage.Login_Error;
self.suiMessageDialog1.ShowModal();
end;
end;错误信息:Project TrainMIS.exe raised exception class EAccessViolation with message 'Access violation at adress 004044c8 in module 'TrainMIS.exe' . write of address 0000033c请问这是咋回事阿?!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货