日期:2014-05-18  浏览次数:20762 次

连接数据库问题
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……