请教数据库连接问题:出现错误sql server不存在或访问被拒绝.

peanut2008 2005-06-25 02:58:10
datamoudle中的代码
String sUserID,sPassWord,sDATABASENAME,sSERVERNAME;
TIniFile *ini;
ini = new TIniFile( ChangeFileExt( "a", ".INI" ) );
sUserID = ini->ReadString( "DatabaseStrings", "USERID", "sa" );
sPassWord = ini->ReadString( "DatabaseStrings", "Password", "007" );
sDATABASENAME = ini->ReadString( "DatabaseStrings", "DATABASENAME", "mis" );
sSERVERNAME = ini->ReadString( "DatabaseStrings", "SERVERNAME","(local)" );
delete ini;

String sTemp ;
sTemp = sTemp + "Provider=SQLOLEDB.1;" ;
sTemp = sTemp + "Password="+sPassWord+";" ;
sTemp = sTemp + "User ID=" +sUserID + ";";
sTemp = sTemp + "Initial Catalog=" + sDATABASENAME + ";";
sTemp = sTemp + "Data Source=" + sSERVERNAME ;
ADOConnection1->ConnectionString = sTemp;
ADOConnection1->Connected=true;
ADOConnection1->Open();

我的ini文件:
[DatabaseStrings]
userid=sa
Password=007
DATABASENAME=mis
SERVERNAME=(local)
...全文
97 回复 打赏 收藏 举报
写回复
回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
相关推荐
发帖
数据库及相关技术
加入

1167

社区成员

C++ Builder 数据库及相关技术
申请成为版主
帖子事件
创建了帖子
2005-06-25 02:58
社区公告
暂无公告