日期:2014-05-17  浏览次数:20827 次

ado.net中sql.connection链接不成功,但是使用工具链接是成功的。。。。。

 string server = newServer;
            string catalog = newCatalog;
            string connectionString = "server=" + server + ";Initial Catalog=" + catalog + ";Persist Security Info=False";
            SqlConnection connection = new SqlConnection(connectionString);
            try
            {
                connection.Open();
            }
            catch (Exception e)
            {
                return false;
            }
            return true;
这个里面我用工具连接的时候是可以连通的,但是用sqlconnection链接却连不通,有谁知道为什么吗

------解决方案--------------------
引用:
推荐使用sql server身份验证,貌似楼主的连接字符串中少了Integrated Security=SSPI;

test
------解决方案--------------------
引用:
Quote: 引用:

Quote: 引用:

Quote: 引用:

推荐使用sql server身份验证,貌似楼主的连接字符串中少了Integrated Security=SSPI;
integrated security不是false吗?

http://www.cnblogs.com/lanse777/archive/2007/03/28/691757.html 但是你没写~~
用用户登录是成功的。。。。。。。。

我知道,但是连接字符串有规定的写法~