首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

连接数据库有关问题

2012-02-14 
连接数据库问题string str_sqlconnection server.\\SQLEXPRESSInitial CatalogXFGLIntegrated Secu

连接数据库问题
string str_sqlconnection = "server=.\\SQLEXPRESS;Initial Catalog=XFGL;Integrated Security=false;uid=sa;pwd=789456;";
上面的样子能连接上,但是把.\\SQLEXPRESS改成127.0.0.1或者localhost就失败了,请问为什么?

[解决办法]
string str_sqlconnection = "server=127.0.0.1\\SQLEXPRESS;Initial Catalog=XFGL;Integrated Security=false;uid=sa;pwd=789456;";

而不是
string str_sqlconnection = "server=127.0.0.1;Initial Catalog=XFGL;Integrated Security=false;uid=sa;pwd=789456;";

[解决办法]

探讨
string str_sqlconnection = "server=127.0.0.1\\SQLEXPRESS;Initial Catalog=XFGL;Integrated Security=false;uid=sa;pwd=789456;";

而不是
string str_sqlconnection = "server=127.0.0.1;Initial Catalog=XFGL;I……

热点排行