C
C#2y ago
skillyn

❔ Line of code not working unless stepped through using breakpoint

4 Replies
growlingOwl
growlingOwl2y ago
A suggestion. You could create a console app to isolate your issue and tinker with it. I can see that you're getting fairly descriptive error message.
Buddy
Buddy2y ago
$sqlinjection
MODiX
MODiX2y ago
Always parameterize queries! https://i.imgur.com/uePzr0S.jpeg Do not concatenate the query, example:
// Do NOT do this
string query = "SELECT * FROM users WHERE username='" + UserName + "';";
...
// Do NOT do this
string query = "SELECT * FROM users WHERE username='" + UserName + "';";
...
But instead always parameterize your queries. Look up the documentation for said Database library. If you are using System.Data.SqlClient refer to this https://learn.microsoft.com/en-us/dotnet/api/system.data.sqlclient.sqlcommand.parameters?view=dotnet-plat-ext-7.0#examples
Imgur
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server