我想用一个edit做一个模糊输入,即它里面(edit.text)如果输入的是如47120094之类的数字串,我就用
我数据库中的一个和他对应的字段来做查询的where 的条件.如果输入的是如'黄飞宏',我就用另外一个字段来做查询的where条件,请问怎么判断edit里面输入的是以上两种''串''呢?
例如:
我想的语句是:
if edit.text里面输入的是数字串 then
conditionStr:=student_Number;
if edit.text里面输入的是汉字串 then
conditionStr:=student_Name;sql.add('select * from tb1 where'''+conditionStr+''' like'''+edit.text+'''');
请问上面的if条件怎么做才能实现呀?
我数据库中的一个和他对应的字段来做查询的where 的条件.如果输入的是如'黄飞宏',我就用另外一个字段来做查询的where条件,请问怎么判断edit里面输入的是以上两种''串''呢?
例如:
我想的语句是:
if edit.text里面输入的是数字串 then
conditionStr:=student_Number;
if edit.text里面输入的是汉字串 then
conditionStr:=student_Name;sql.add('select * from tb1 where'''+conditionStr+''' like'''+edit.text+'''');
请问上面的if条件怎么做才能实现呀?
StrToInt(Edit1.Text);
conditionStr:=student_Number;
except
conditionStr:=student_Name;
end;你看这样行不?楼主?
if edit.text in [0..9] then
conditionStr:=student_Number;
else
conditionStr:=student_Name;sql.add('select * from tb1 where'''+conditionStr+''' like'''+edit.text+'''');
try
StrToInt64(Edit1.Text);
……//是数字串
except
……//不是数字串
end;