I want to know if there are any commands that you can use in C# that can protect against SQL Injection.
I have a program that is connected to my database, I want to ensure that they cannot enter any malicious code through a text box or other means.
string Query = "Update users SET Calories = @Calories WHERE username = '" + txtName.Text + "' AND Day = '" + cboDayofWeek.Text + "'";
MySqlCommand cmd = new MySqlCommand(Query, Conn);
cmd.Parameters.AddWithValue("@Calories", txtCalories.Text);