数据库问题???sos???

dxlth 2002-10-30 02:15:40
var str:string;
begin
str:='select * from pjinfom where '''+Formatdatetime('yyyy-mm-dd',datetimepicker1.date)+''' < pjtime and pjtime< '''+Formatdatetime('yyyy-mm-dd',datetimepicker2.date)+ '''';
if Edit1.text <> '' then

str:=str+' and pjid = '''+ Edit1.text +'''';

if Edit2.text <> '' then
str:=str+' and name = '''+Edit2.text+'''';
if Edit3.text <> '' then
str:=str+' and dname = '''+Edit3.text+'''';
if edit4.text <> '' then
str:=str+' and job = '''+edit4.text+'''';
if edit5.Text <> '' then
str:=str+' and pjpace = '''+edit5.text+'''';

with dm.Query4 do
begin
Close;
SQL.Clear;
SQL.Add(str);
如果edit1.text要求输入的是数字不是字付怎么半
...全文
34 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
baby19820917 2002-10-30
  • 打赏
  • 举报
回复
在你的edit1的OnKeyPress里加上限定就好了吗。
if not key>9 and key<0 then key:=#0;
这样不是就可以了吗。至于其他的条件你自己家就好了。
RobinHZ 2002-10-30
  • 打赏
  • 举报
回复
agree 楼上,不过略作修改...

在edit1的OnKeyPress事件中:
if not (Key in ['0'..'9', #13, #8]) then Key := #0;
happyzsl 2002-10-30
  • 打赏
  • 举报
回复
sql语句不用变
happyzsl 2002-10-30
  • 打赏
  • 举报
回复
在edit1的OnKeyPress事件中
if not (Key in ['1','2','3','4','5','6','7','8','9','0'])then Key := #0;

2,498

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧