C
C#9mo ago
Rhys

✅ .NET8 Connection String Login Failure With Dapper

I have tested my username and password in SQL server management studio and the connection works fine. But when I try using my connection string through my API, my connection string fails.
"DBConnection": "Data Source=** ; Initial Catalog=** ; User Id=**; Password=**; Trusted_Connection=false; Integrated Security=false"
"DBConnection": "Data Source=** ; Initial Catalog=** ; User Id=**; Password=**; Trusted_Connection=false; Integrated Security=false"
Previously this did work with .NET 6 but now creating a new project in .NET 8 it breaks. Any advice or fixes are appreciated!
11 Replies
Pobiega
Pobiega9mo ago
are you getting any error messages or something when establishing the connection? can you reproduce in a barebones console app?
Rhys
Rhys9mo ago
I will check these now 🙂 Login failed for user 'USER' system.data.SqlClient.SqlExceptions
Pobiega
Pobiega9mo ago
well there ya go it doesnt like your login credentials
Rhys
Rhys9mo ago
They work on the SQL server management studio though, they have permissions and are valid login credentials
Pobiega
Pobiega9mo ago
inspect your string with a hexeditor or something make sure there are no unexpected invisible characters
Rhys
Rhys9mo ago
Will check now ty!
Pobiega
Pobiega9mo ago
what database is this btw? MSSQL? you might need TrustServerCertificate=true later versions of SqlClient have changed the default for verifying the servers ssl cert
Rhys
Rhys9mo ago
Oh my god... My colleague is as stupid as it gets The password was wrong, he said it worked in SQL server management studio. I made him test it and it was wrong. Lord save me
Pobiega
Pobiega9mo ago
🙂
Unknown User
Unknown User9mo ago
Message Not Public
Sign In & Join Server To View
MODiX
MODiX9mo ago
Use the /close command to mark a forum thread as answered
Want results from more Discord servers?
Add your server