code_junkie

Why won't my c# connection string to a SQL server work with Windows authentication?

Nov 11th, 2011
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. {
  2. OdbcConnection cn = null;
  3. String connectionString;
  4. connectionString = "Driver={SQL Server};Server=" + cbxDataSources.Text +";Database=" + strDatabase + ";";
  5.  
  6. connectionString += "UID=" + textBoxUserName.Text + ";";
  7. connectionString += "PWD=" + textBoxPassword.Text + ";";
  8.  
  9. cn = new OdbcConnection(connectionString);
  10. return cn;
  11. }
  12.  
  13. Driver={SQL Native Client};Server=myServerAddress;Database=myDataBase;Trusted_Connection=yes;
  14.  
  15. Driver={SQL Server};Server=myServerAddress;Database=myDataBase;Trusted_Connection=Yes;
Add Comment
Please, Sign In to add comment