DElPHI与报表之间传参数(200分)

  • 主题发起人 主题发起人 一叶风铃
  • 开始时间 开始时间

一叶风铃

Unregistered / Unconfirmed
GUEST, unregistred user!
请教各位一个问题.<br>很急的问题.<br>我想在FASTREPORT报表中写好有参数的SQL语句.<br>打印报表的时候.我只要传入参数?<br>这个想法可不可以实现<br>如果可以实现<br>怎么去实现他.<br><br>我现在碰到的总是<br>报表中两个QUERY<br>QUERY1.SQL := SELECT SS_ID, COMP_ID, DEST_COMP_ID, SS_DOC_NO, SS_WAYBILLNO,<br>&nbsp; &nbsp; &nbsp; &nbsp;PORT_CODE, PORT_NAME, CAR_HK_PLATE, CAR_CS_PLATE, CAR_CUSTOMSNUM,<br>&nbsp; &nbsp; &nbsp; &nbsp;CAR_DRIVER, CAR_MAXVOL, CAR_W_MAX, DCL_DATE, SS_KJ1, SS_KJ2, SS_KJ3,<br>&nbsp; &nbsp; &nbsp; &nbsp;SS_D_TYPE, SS_PCS_TOTAL, SS_W_TOTAL, SS_VALUE_TOTAL, SS_BARGAIN_CU,<br>&nbsp; &nbsp; &nbsp; &nbsp;SS_SPY_CU, SS_ORIGIN, SS_DEST, PRINT_COUNT, IS_CHECK_OVER, SS_LOCK,<br>&nbsp; &nbsp; &nbsp; &nbsp;SS_CANCELED, IS_CHECKING, CHECKER_CODE, CHECKER, CHCK_OVER_TIME,<br>&nbsp; &nbsp; &nbsp; &nbsp;IS_CALC_OTHER_FEE, REMARK, CREATER, CREATETIME, EDITOR, EDITTIME,<br>&nbsp; &nbsp; &nbsp; &nbsp;BAK_FIELD1, SS_LOADING, SS_UNLOADING, IS_V_CUST,<br>&nbsp; &nbsp; &nbsp; &nbsp;DEST_COMP_NAME = (SELECT TOP 1 COMP_NAME FROM &nbsp;TB_COMPANY_INFO WHERE COMP_ID = S.DEST_COMP_ID)<br>FROM TB_SHIPMENTS S<br>WHERE COMP_ID = 105 AND SS_DOC_NO = '200801100002'<br>&nbsp;AND IS_CHECK_OVER = 0<br><br>QUERY2.SQL := SELECT &nbsp;SWB_ID, SOURCE_COMP_ID , COMP_ID , SS_ID , SS_DOC_NO &nbsp;, SS_WAYBILLNO ,<br> &nbsp;MASTER_BILL_ID , MAIN_BILL, HB_SS_ID, HB_SS_HBNO, SWB_DCL_CODE ,<br> &nbsp;SWB_DCL_GDS_NAME ,SWB_DCL_GDS_CODE , HS_CODE , BRAND , STYLE,<br> &nbsp;SPECIFICATIONS , &nbsp;DCL_CALC_TYPE , DCL_CALC_TYPE_DESCR &nbsp;, SWB_CTNS ,<br> &nbsp;SWB_PCS &nbsp;, SWB_UNIT &nbsp;, SWB_GW &nbsp;, SWB_NW &nbsp;, RATE_CODE &nbsp;, RATE_EX_IM ,<br> &nbsp;SWB_U_PRICE , SWB_AMOUNT , SWB_DCL_TYPE , SWB_DCL_STATE &nbsp;, SWB_V_SHIP ,<br> &nbsp;SWB_V_SHIP_ADDR, SWB_V_CNEE, SWB_V_CNEE_ADDR &nbsp;, SWB_DCL_DATE ,<br> &nbsp;REMARK , &nbsp;CREATER , CREATETIME , EDITOR , EDITTIME, BAK_FIELD1<br>&nbsp;FROM DBO.TB_SUB_WAYBILL A<br>WHERE COMP_ID = :COMP_ID(来于QUERY1)<br>AND SS_DOC_NO = :SS_DOC_NO(来于QUERY1)<br><br><br>报表的OnActivate事件<br>begin<br>&nbsp; STR := 'SELECT SS_ID, COMP_ID, DEST_COMP_ID, SS_DOC_NO, SS_WAYBILLNO,'+<br>&nbsp; &nbsp; &nbsp; &nbsp;'PORT_CODE, PORT_NAME, CAR_HK_PLATE, CAR_CS_PLATE, CAR_CUSTOMSNUM,'+<br>&nbsp; &nbsp; &nbsp; &nbsp;'CAR_DRIVER, CAR_MAXVOL, CAR_W_MAX, DCL_DATE, SS_KJ1, SS_KJ2, SS_KJ3,'+<br>&nbsp; &nbsp; &nbsp; &nbsp;'SS_D_TYPE, SS_PCS_TOTAL, SS_W_TOTAL, SS_VALUE_TOTAL, SS_BARGAIN_CU,'+<br>&nbsp; &nbsp; &nbsp; &nbsp;'SS_SPY_CU, SS_ORIGIN, SS_DEST, PRINT_COUNT, IS_CHECK_OVER, SS_LOCK,'+<br>&nbsp; &nbsp; &nbsp; &nbsp;'SS_CANCELED, IS_CHECKING, CHECKER_CODE, CHECKER, CHCK_OVER_TIME,'+<br>&nbsp; &nbsp; &nbsp; &nbsp;'IS_CALC_OTHER_FEE, REMARK, CREATER, CREATETIME, EDITOR, EDITTIME,'+<br>&nbsp; &nbsp; &nbsp; &nbsp;'BAK_FIELD1, SS_LOADING, SS_UNLOADING, IS_V_CUST,'+<br>&nbsp; &nbsp; &nbsp; &nbsp;'DEST_COMP_NAME = (SELECT TOP 1 COMP_NAME FROM &nbsp;TB_COMPANY_INFO WHERE COMP_ID = S.DEST_COMP_ID)'+<br>'FROM TB_SHIPMENTS S WHERE COMP_ID = '+[STR([dxMemData1."comp_id"])]"](外面传进来的)+<br>' AND SS_DOC_NO = '''+[dxMemData1."SS_DOC_NO"](外面传进来的)+<br>''' AND IS_CHECK_OVER = 0';<br>&nbsp; Q_SHIPMENT.SQL := STR;<br><br>&nbsp; ModalResult := mrok;<br>end<br><br><br>报表打印时我的参数传不进来..<br><br>QQ154162809
 
应该可以,是什么错误?
 
后退
顶部