且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

SQL连接字符串忽略UserID

更新时间:2022-12-03 14:34:15

也许这是你应该发布的地方。


https://social.msdn.microsoft.com/Forums/sqlserver/en-US/home?类别= SQLSERVER


Using the code below to connect to a SQL server and for half the users it connects using the user "john" from the query string and connects fine but others its using the same query string but ignores the userID and uses their windows id instead.

Has anyone else come across this and why it ignores the userID?

Thanks,

John

using (SqlConnection connection = new SqlConnection("Data Source=sqlServer;Database=dbName;User Id=john;Password=pass123;")) {
connection.Open(); // Do work here; connection closed on following line.
connection.Close();
}

https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection(v=vs.110).aspx

maybe it's where you should post.

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/home?category=sqlserver