delphi的基本语法问题!!

melior 2004-08-30 02:38:09
下面的句子大家能帮我改改错误吗?我对delphi不熟!请大家指教!
begin

mj1 := integer(txtmj1.Text);
mj2 := integer(txtmj2.Text);
zj1 := integer(txtzj1.Text);
zj2 := integer(txtzj2.Text);

if mj1 > mj2 then
mj1 := integer(txtmj2.Text);
mj2 := integer(txtmj1.Text);
if zj1 > zj2 then
zj1 := integer(txtzj2.Text);
zj2 := integer(txtzj1.Text);

g_Title := '查询结果:';

Map1.Layers.ClearSelection;

ssql := 'select 组名,户编号 from TENANCY where 1=1 ';

if txtssqy.Text <> '' then
ssql := ssql + ' and 所属区域 = ' + QuotedStr(txtssqy.Text);

if txtlxr.Text <> '' then
ssql := ssql + ' and 联系人 = ' + QuotedStr(txtlxr.Text);

if txtlxfs.Text <> '' then
ssql := ssql + ' and 联系方式 = ' + QuotedStr(txtlxfs.Text);

if txtlxdz.Text <> '' then
ssql := ssql + ' and 联系地址 = ' + QuotedStr(txtlxdz.Text);

if txthx.Text <> '' then
ssql := ssql + ' and 户型 = ' + QuotedStr(txthx.Text);

if txtlc.Text <> '' then
ssql := ssql + ' and 楼层 = ' + QuotedStr(txtlc.Text);

if txtwz.Text <> '' then
ssql := ssql + ' and 位置 = ' + QuotedStr(txtwz.Text);

if (txtmj1.Text <> '') and (txtmj2.Text <> '') then
ssql := ssql + ' and 面积 >= ' + string(mj1) + ' and 面积 <=' + string(mj2) ;

if (txtzj1.Text <> '') and (txtzj2.Text <> '') then
ssql := ssql + ' and 租金 >= ' + string(zj1) + ' and 租金 <= ' +string(zj2);

if txtfwss.Text <> '' then
ssql := ssql + ' and 房屋设施 = ' + QuotedStr(txtfwss.Text);

//ShowMessage(ssql);
adoSearch.Close;
adoSearch.sql.Clear;
adoSearch.sql.Add(ssql);
adoSearch.Open;
...全文
107 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
melior 2004-08-30
  • 打赏
  • 举报
回复
楼上的,是啊,我改成mj1 := StrToInt(txtmj1.Text);后
当填写txtmj1.Text小于txtmj2.Text的时候mj1的值和mj2的值都是最小的那个值
当填写txtmj1.Text大于txtmj2.Text的时候mj1的值和mj2的值显示正确mj1 = txtmj2.Text,mj2 = txtmj1.text
应该是我判断的语句写的有问题,正确的写法是什么样子的呢?
cctaiyang 2004-08-30
  • 打赏
  • 举报
回复
同意上面的说法,但是可能mj1、mj2、zj1、zj2值会出现重复
luke5678 2004-08-30
  • 打赏
  • 举报
回复
光从语法上讲上面的代码是可以通过编译的
cctaiyang 2004-08-30
  • 打赏
  • 举报
回复
面积和租金在数据库中是数字,我想当查询的时候自动把小一些的数值放到前面
luke5678 2004-08-30
  • 打赏
  • 举报
回复
intefer(txtmj1.Text)之类的错了吗???
xufeng_tj 2004-08-30
  • 打赏
  • 举报
回复
老大,开玩笑阿
当然是用strtoint函数了
梅青松 2004-08-30
  • 打赏
  • 举报
回复
mj1 := integer(txtmj1.Text);
---
mj1 := StrToInt(txtmj1.Text);
alexanda2000 2004-08-30
  • 打赏
  • 举报
回复
是不是要把integer(txtmj1.Text)之类的改成strtoint(txtmj1.text)啊?

5,386

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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