下面的句子大家能帮我改改错误吗?我对delphi不熟!请大家指教!
beginmj1 := 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;
beginmj1 := 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;
---
mj1 := StrToInt(txtmj1.Text);
当然是用strtoint函数了
当填写txtmj1.Text小于txtmj2.Text的时候mj1的值和mj2的值都是最小的那个值
当填写txtmj1.Text大于txtmj2.Text的时候mj1的值和mj2的值显示正确mj1 = txtmj2.Text,mj2 = txtmj1.text
应该是我判断的语句写的有问题,正确的写法是什么样子的呢?