pb 编程高手救命

来源:百度知道 编辑:UC知道 时间:2024/07/02 17:11:25
dw_1.settransobject(sqlca)
string date1,qr,zr,sdate
date qrd,zrd
zr=string(ole_1.object.value)
qr=string(ole_1.object.value)
qrd=date(qr)
zrd=date(zr)
date1="select op.op_visit.visit_no,op.op_visit.pat_name,op.op_charge.item_cnname,op.op_chgnote.sum_receivable, hthis.p_employee.fempName from op.op_chgnote,op.op_visit,op.op_charge,hthis.p_employee where op.op_chgnote.ssysdate>='"+qrd+"'"+"and op.op_chgnote.ssysdate<='"+zrd+"' and op.op_visit.visit_id=op.op_charge.visit_id and op.op_charge.chgnote_id=op.op_chgnote.chgnote_id and hthis.p_employee.fempId=op.op_chgnote.suser_id";
dw_1.settransobject(sqlca)
dw_1.setsqlselect(date1)
dw_1.retrieve()
if dw_1.rowcount()<0 then
messagebox("提示","未找到该日期段数据")
end if

我这段代码总是报错 不知道怎么该啊
谢谢这位大侠,您这种方法我也试过了,这样会在date1那条sql语句中提示类型不匹配,op.op_chgnote.ssysdate是date类型 ,"+qrd+"'这个是字符串

你这样写的基础是,dw_1引用的数据窗口对象必须符合date1那些SQL所读取的字段类型,就是说数据窗口的SQL的select部分也需要和SQL一致。

你的代码应改成:

string date1,qr,zr,sdate
date qrd,zrd
zr=string(ole_1.object.value)
qr=string(ole_1.object.value)
qrd=date(qr)
zrd=date(zr)
date1="select op.op_visit.visit_no,op.op_visit.pat_name,op.op_charge.item_cnname,op.op_chgnote.sum_receivable, hthis.p_employee.fempName from op.op_chgnote,op.op_visit,op.op_charge,hthis.p_employee where op.op_chgnote.ssysdate>='"+qrd+"'"+"and op.op_chgnote.ssysdate<='"+zrd+"' and op.op_visit.visit_id=op.op_charge.visit_id and op.op_charge.chgnote_id=op.op_chgnote.chgnote_id and hthis.p_employee.fempId=op.op_chgnote.suser_id"
dw_1.setsqlselect(date1)
dw_1.settransobject(sqlca)
dw_1.retrieve()
if dw_1.rowcount()<0 then
messagebox("提示","未找到该日期段数据")
end if

如果仍有错误,请把错误一并贴上来。