本文介绍了什么是用于检查同一文本框中的多个值的查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从一个文本框中输入email_id或user_name

我正在使用此查询,但它仅占用查询的第一个字段,即email_id,user_name
失败

i want to enter either email_id or user_name from one textbox

i am using this query but it is taking only first field from query i.e. email_id it is failed for user_name

string str = "select login_with_email from PROFILE where  email_id='" + txt_login_userid.Text.Trim() + "' OR user_name ='" + txt_login_userid.Text.Trim() + "' and password= ' " + txt_login_pass.Text.Trim()+'" " ;



[edit]添加了代码块[/edit]



[edit]code block added[/edit]

推荐答案

string str = "select login_with_email from PROFILE where (email_id='" + txt_login_userid.Text.Trim() + "' OR user_name ='" + txt_login_userid.Text.Trim() + "') and password= ' " + txt_login_pass.Text.Trim()+'" " ; 


但是,认真的说,我不想开始指出有多少问题是错误的.至少使用sql参数.


But seriously I don''t want to start pointing how many things is wrong with this. Use sql parameters at least.


这篇关于什么是用于检查同一文本框中的多个值的查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-27 09:28
查看更多