在C#桌面应用程序中,我使用
"select * from reg where username='" + user + "' and password='" + pass + "' and key='" + key + "'";
选择记录,但我正在试图弄清楚,如果我想从单个输入(如
看起来条件对
"select * from reg where username='" + UserOrEmail + "' or email='" + UserOrEmail + "' and password='" + pass + "' and key='" + key + "'";
您需要括号,因为运算符
"select * from reg where (username='" + UserOrEmail + "' or email='" + UserOrEmail + "') and password='" + pass + "' and key='" + key + "'";
或者使用运算符
"select * from reg where '" + UserOrEmail + "' in (username, email) and password='" + pass + "' and key='" + key + "'";