unit SysObject;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Inifiles, ADODB, DB, StdCtrls, te_controls, RzCmboBx, ExtCtrls;type
TSysObject = Class(TObject)
private
FHost, FTable, FUser, FPwd :string;
public
property _Host :string read FHost write Fhost;
property _Table :string read FTable write FTable;
property _User :string read FUser write FUser;
property _Pwd :string read FPwd write FPwd;
//读入配置文件
procedure ReadIni(State :integer; S :string);
end;implementationuses FormReg, RegExpr;procedure TSysObject.ReadIni(State :integer; S :string);
var
nIniFile :TIniFile;
nFileName :string;
begin
nFileName := ExtractFilePath(ParamStr(0))+S;
if FileExists(nFileName) then
begin
nIniFile := TIniFile.Create(nFileName);
if State = 0 then
begin
FHost := nIniFile.ReadString('Setup','SrvIP','');-->这句开始报错
FTable := nIniFile.ReadString('Setup','SrvDB','');
FUser := nIniFile.ReadString('Setup','SrvUser','');
FPwd := nIniFile.ReadString('Setup','SrvPwd','');--到这句结束
end;
nIniFile.Free;
end;
end;end.我这样写错了吗,请各位大侠指教
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Inifiles, ADODB, DB, StdCtrls, te_controls, RzCmboBx, ExtCtrls;type
TSysObject = Class(TObject)
private
FHost, FTable, FUser, FPwd :string;
public
property _Host :string read FHost write Fhost;
property _Table :string read FTable write FTable;
property _User :string read FUser write FUser;
property _Pwd :string read FPwd write FPwd;
//读入配置文件
procedure ReadIni(State :integer; S :string);
end;implementationuses FormReg, RegExpr;procedure TSysObject.ReadIni(State :integer; S :string);
var
nIniFile :TIniFile;
nFileName :string;
begin
nFileName := ExtractFilePath(ParamStr(0))+S;
if FileExists(nFileName) then
begin
nIniFile := TIniFile.Create(nFileName);
if State = 0 then
begin
FHost := nIniFile.ReadString('Setup','SrvIP','');-->这句开始报错
FTable := nIniFile.ReadString('Setup','SrvDB','');
FUser := nIniFile.ReadString('Setup','SrvUser','');
FPwd := nIniFile.ReadString('Setup','SrvPwd','');--到这句结束
end;
nIniFile.Free;
end;
end;end.我这样写错了吗,请各位大侠指教
Project xxx.exe raised exception class EAccessViolation with message 'Access Violation at address 00404418 in module 'xxx.exe'. Write of address 00000008. Processs stopped. Use Step or Run to continue
vSysObject: TSysObject;
begin
vSysObject := TSysObject.Create;
{ TODO }
vSysObject.Free;
end;