C
C#10mo 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
Pobiega10mo ago
are you getting any error messages or something when establishing the connection? can you reproduce in a barebones console app?
Rhys
RhysOP10mo ago
I will check these now 🙂 Login failed for user 'USER' system.data.SqlClient.SqlExceptions
Pobiega
Pobiega10mo ago
well there ya go it doesnt like your login credentials
Rhys
RhysOP10mo ago
They work on the SQL server management studio though, they have permissions and are valid login credentials
Pobiega
Pobiega10mo ago
inspect your string with a hexeditor or something make sure there are no unexpected invisible characters
Rhys
RhysOP10mo ago
Will check now ty!
Pobiega
Pobiega10mo 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
RhysOP10mo 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
Pobiega10mo ago
🙂
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
MODiX
MODiX10mo ago
Use the /close command to mark a forum thread as answered
Want results from more Discord servers?
Add your server