为什么两个表达式的结果不同?

时间:2017-07-09 02:44:12

标签: c# mysql

MySQL Expression One:

string userName = InputUser.Text.ToString().Trim();
string judgeStr = "select * from users where username='"+userName+"'";

MySQL Expression Two:

string userName = InputUser.Text.ToString().Trim();

string judgeStr = "select * from users where username='@username'";  
judgeCmd.Parameters.AddWithValue("@username", userName);

结果应该不一样?

0 个答案:

没有答案