回复 2楼 mywisdom88
不行,我的代码是这样的,也不知道错在哪里,我在数据工作期看到明明card01有3条记录,但就是只显示了一条
SELECT card02
a1=一级区
SELECT card03
a2=维修标记
RESTORE FROM D:\水表报修\bxqx.txt addi
lcodbcdriver
=ALLTRIM(szb_类型)
lcodbcserver
=ALLTRIM(szb_服务器)
lcodbcdatabase=ALLTRIM(szb_数据库)
lcuid
=ALLTRIM(szb_用户)
lcpwd
=ALLTRIM(szb_密码)
con1=sqlstringconnect('driver='+lcodbcdriver+';server='+lcodbcserver+';database='+lcodbcdatabase+';uid='+lcuid+';pwd='+lcpwd) &&建立测试连接句柄
if con1>0
thisform.grid1.recordsource=""
TEXT TO SqlStr NOSHOW TEXTMERGE PRETEXT 4
select 选择,受理单号,报修时间,报修人,报修人电话,报修地址,报修内容,报修类型,特殊情况,一级区,二级区,bill_name as 业主,tel as 业主电话,mobile as 业主手机,calibre as 口径,维修标记
from bx a left join a_card d on a.受理单号 =d.card_no
left join a_client c on
d.client_no = c.client_no
left join m_meter b on b.meter_id = d.meter_id
where 维修标记=?a2 and 一级区=?a1
order by 报修时间 desc
endtext
sqlexec(con1,SqlStr,'card01')
REPLACE ALL 选择 WITH 0
thisform.grid1.recordsource="card01"
thisform.grid1.SetAll("dynamicbackcolor","iif(维修标记='派工',rgb(0,255,255),IIF(维修标记='维修结束',RGB(150,154,240),IIF(维修标记='临时通水',RGB(0,154,240),RGB(255,255,0))))", "Column")
thisform.grid1.refresh
SQLEXEC(con1,"select 二级区 from bx WHERE 一级区 = ?a1 group by 二级区 ","card04")
thisform.grid5.recordsource="card04"
SQLDISCONNECT(con1)
&&断开连接句柄
else
messagebox("连接失败,请检查网络及设置!",0,"警告")
ENDIF