I’m trying to log into a SQL Server database through ODBC (the DSN is well configured) but when I try to make the connection in .NET it keeps me asking for the user credentials that I already saved in the ODBC Configuration in Windows, I mean, if I already saved the credentials, why should I provide them again?
What could it be?
Thank you.
PD: The connection string is just “Dsn=mydsn”.
DSN’s do not store the user name and password information. If you look closely at the text on that page of the wizard it simply is prompting for the username and password so that it can retrieve additional information for drop down lists in subsequent pages of the wizard.
You can use Windows integrated security to log on as the current windows user. If you want to use SQL authentication, you have to pass the username and password in the connection string.
ConnectionStrings.com is a great resource for getting connection string syntax for things like this. See the section for ODBC which has examples of trusted connection as well as prompting for password.