关于ini读取错误问题?
2008-10-20 10:29
148 查看
关于ini读取错误问题? Delphi / Windows SDK/API
http://www.delphi2007.net/DelphiDB/html/delphi_20061224190355128.html
Filename:=ExtractFilePath(Paramstr(0))+'SET.INI';
Sid:=ini.ReadString('SETCONFIG','SERVERUSER','sa');
Sname:=ini.ReadString('SETCONFIG','SERVERNAME','yyjys');
SDname:=ini.ReadString('SETCONFIG','SERVERDBNAME','sims');
ini.Free;
会出现一个内存错误对话框?
ini:=TRegIniFile.Create; //你做了吗?
你回复之前,我已经找到错误拉。
try
AdoTable1.Active:=true;
except
begin
MessageBox(handle,'数据库连接有问题请与管理员联系!','错误',MB_ok or MB_ICONERROR);
application.Terminate;
end;
end;
在无法连接时候
这个代码为什么不执行application.terminate呢???
gz
var
tempIni: TIniFile;
begin
tempIni :=TIniFile.Create(extractfilepath(ParamStr(0))+'sys.ini');
SQLServerName := tempIni.ReadString('SYSTEM', 'SERVER', '');
SQLDBName := tempIni.ReadString('SYSTEM', 'DBNAME', '');
Password := tempIni.ReadString('SYSTEM', 'Password','');
tempIni.Free;
ConnString :='Provider=SQLOLEDB.1;Password='+password
+';Persist Security Info=True;User ID=sa;Initial Catalog='
+SQLDBName+';Data Source='+SQLServerName;
try
sysdm.DBConnect.connected := false;
sysdm.DBConnect.ConnectionString := ConnString;
sysdm.DBConnect.connected := true;
except
on e:EoleException do
begin
if e.Errorcode = -2147217843 then
begin
MsShow('数据库密码不对!');
end
else if e.Errorcode = -2147467259 then
begin
showmessage('数据库服务器名或数据库名不对!');
application.Terminate;
end;
end;
end;
http://www.delphi2007.net/DelphiDB/html/delphi_20061224190355128.html
Filename:=ExtractFilePath(Paramstr(0))+'SET.INI';
Sid:=ini.ReadString('SETCONFIG','SERVERUSER','sa');
Sname:=ini.ReadString('SETCONFIG','SERVERNAME','yyjys');
SDname:=ini.ReadString('SETCONFIG','SERVERDBNAME','sims');
ini.Free;
会出现一个内存错误对话框?
ini:=TRegIniFile.Create; //你做了吗?
你回复之前,我已经找到错误拉。
try
AdoTable1.Active:=true;
except
begin
MessageBox(handle,'数据库连接有问题请与管理员联系!','错误',MB_ok or MB_ICONERROR);
application.Terminate;
end;
end;
在无法连接时候
这个代码为什么不执行application.terminate呢???
gz
var
tempIni: TIniFile;
begin
tempIni :=TIniFile.Create(extractfilepath(ParamStr(0))+'sys.ini');
SQLServerName := tempIni.ReadString('SYSTEM', 'SERVER', '');
SQLDBName := tempIni.ReadString('SYSTEM', 'DBNAME', '');
Password := tempIni.ReadString('SYSTEM', 'Password','');
tempIni.Free;
ConnString :='Provider=SQLOLEDB.1;Password='+password
+';Persist Security Info=True;User ID=sa;Initial Catalog='
+SQLDBName+';Data Source='+SQLServerName;
try
sysdm.DBConnect.connected := false;
sysdm.DBConnect.ConnectionString := ConnString;
sysdm.DBConnect.connected := true;
except
on e:EoleException do
begin
if e.Errorcode = -2147217843 then
begin
MsShow('数据库密码不对!');
end
else if e.Errorcode = -2147467259 then
begin
showmessage('数据库服务器名或数据库名不对!');
application.Terminate;
end;
end;
end;
相关文章推荐
- 关于vc读取ini单引号丢弃问题
- 关于装双Win7系统方法及问题:错误0x80070571:磁盘结构损坏且无法读取
- 关于getprivateprofilestring 读取 windows 文件夹下ini文件异常问题的探究
- 问题解决——OpenGL超级宝典 关于gltDrawTorus的错误解决
- 关于VC在64位系统下读取注册表启动项时遇见的读取的数据与实际不一致的问题
- PAT A1038 Recover the Smallest Number 算法问题和关于'0'和0的小错误
- 关于读取php中文文件名乱码问题
- 关于MVC架构中错误处理的问题
- 关于upload_max_filesize设置一直是2M,导致dede图片集上传图片出现upload error错误的问题
- 关于Windows Phone的HttpNotificationChannel的Open错误问题
- 解决关于Eclipse打包jar包后 运行结果错误的问题
- UserControl 中包含封装了集合对象的属性被设计器自动初始化所引起的错误!也有关于List的问题
- 关于Linux 下的错误路由产生火星包的问题
- 关于ajax传值错误问题
- 关于List<>的循环添加与读取问题
- 关于文件读取的eof问题
- 关于加载类型库错误的问题
- 记录一次php-fpm 启动加载php.ini 错误问题
- 关于as遇到的Enable "Android Support" Plugin错误问题
- 【转】关于Android4.0 emulator-arm.exe-应用程序错误,内存不能为"read"问题解决方法