源程序:
const
CoarriSql = ' SELECT DISTINCT SC.CONFIRMED_DATE,V.ENG_VESSEL_NAME, '
+ ' BC.CONTAINER_NO,BC.EQUIP_SIZE,BC.EQUIP_TYPE_CODE, '
+
' CE.EQ_CODE,c.EMPTYLADEN_TYPE,BC.GROSS_WEIGHT*1000 AS GROSS_WEIGHT,SC.EXPIMP_TYPE ' +
' FROM SHIPMENT_CONFIRMATION SC ' +
' JOIN VESSEL V ON SC.VESSEL_CODE=V.VESSEL_CODE and SC.VANID_CODE=V.VANID_CODE ' +
' JOIN BL_HEAD BH on SC.VESSEL_CODE=BH.VESSEL_CODE AND SC.VANID_CODE=BH.VANID_CODE ' +
' JOIN BL_CONTAINER BC ON BH.BL_NO=BC.BL_NO AND BH.VANID_CODE=BC.VANID_CODE ' +
' AND BC.CONTAINER_NO<>''''' +
' JOIN CONTAINER C ON BC.CONTAINER_NO=C.CONTAINER_NO AND BC.VANID_CODE=C.VANID_CODE ' +
' LEFT OUTER JOIN CUSTOMER_EQ_TYPE CE on BC.VANID_CODE=CE.VANID_CODE AND '
+ ' BC.OPERATOR_CODE=CE.CUSTOMER_CODE ' +
' AND BC.EQUIP_SIZE=SUBSTR(CE.CONVERSION_CODE,1,2) '
+ ' AND BC.EQUIP_TYPE_CODE=SUBSTR(CE.CONVERSION_CODE,3,6) ';
// + ' left outer join CUSTOMER_EDITERM cedi on bc.OPERATOR_CODE = cedi.customer_code '
// + 'and M.TERMINAL_CODE = cedi.TERMINAL_CODE ';
CoarriGroupBySql = ''; function GetFilter: string;
var
filter: string;
begin
filter := ''; edtOperator2.Text := Trim(edtOperator2.Text);
if edtOperator2.Text <> '' then
Filter := Filter + ' and bc.OPERATOR_CODE=''' + edtOperator2.Text + ''''; // edtReceiver2.Text := Trim(edtReceiver2.Text);
// if edtReceiver2.Text <> '' then
// Filter := Filter + ' and bc.TERMINAL_CODE=''' + edtReceiver2.Text + ''''; edtVOYAGE_NO.Text := Trim(edtVOYAGE_NO.Text);
if edtVOYAGE_NO.Text <> '' then
Filter := Filter + ' and sc.VOYAGE_NO=''' + edtVOYAGE_NO.Text + ''''; if filter <> '' then
begin
Delete(filter, 1, 5);
filter := ' where ' + filter;
end; Result := filter;
end;var
iso_Terminal_code: string;
begin
if not ConnectToSrcDB then
Exit; srcTmpQry.Close;
srcTmpQry.SQL.Text :=
'SELECT VANID_CODE, CUSTOMER_CODE, TERMINAL_CODE,TERMINAL_EDI '
+ 'FROM CUSTOMER_EDITERM WHERE '
+ ' CUSTOMER_CODE = ''' + edtOperator2.Text + ''''
+ 'AND TERMINAL_CODE = ''' + edtReceiver2.Text + '''';
//+ 'VANID_CODE = '' & m_sCurrentVanIDCode & '''
srcTmpQry.Open; if not srcTmpQry.IsEmpty then
iso_Terminal_code := srcTmpQry.FieldByName('TERMINAL_EDI').AsString
else
iso_Terminal_code := edtReceiver2.Text; srcTmpQry.Close; qrySrc.Close;
qrySrc.SQL.Text := CoarriSql + GetFilter + CoarriGroupBySql;
qrySrc.Open;//這里出錯數據庫是interbase,一open就出錯,但相關的sql在Interbase Workbench中運行沒有問題.debug時的錯誤信息:
---------------------------
Microsoft Visual C++ Debug Library
---------------------------
Debug Assertion Failed!Program: D:\CargominingDev\DepotEDI\app\DepotEDI.exe
File: dbgheap.c
Line: 1044Expression: _CrtIsValidHeapPointer(pUserData)For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.(Press Retry to debug the application)
---------------------------
中止(A) 重試(R) 忽略(I)
---------------------------獨立運行時的錯誤信息:---------------------------
Microsoft Visual C++ Debug Library
---------------------------
Debug Error!Program: D:\CargominingDev\DepotEDI\app\DepotEDI.exeDAMAGE: after Normal block (#94) at 0x01947988.
(Press Retry to debug the application)
---------------------------
中止(A) 重試(R) 忽略(I)
---------------------------
const
CoarriSql = ' SELECT DISTINCT SC.CONFIRMED_DATE,V.ENG_VESSEL_NAME, '
+ ' BC.CONTAINER_NO,BC.EQUIP_SIZE,BC.EQUIP_TYPE_CODE, '
+
' CE.EQ_CODE,c.EMPTYLADEN_TYPE,BC.GROSS_WEIGHT*1000 AS GROSS_WEIGHT,SC.EXPIMP_TYPE ' +
' FROM SHIPMENT_CONFIRMATION SC ' +
' JOIN VESSEL V ON SC.VESSEL_CODE=V.VESSEL_CODE and SC.VANID_CODE=V.VANID_CODE ' +
' JOIN BL_HEAD BH on SC.VESSEL_CODE=BH.VESSEL_CODE AND SC.VANID_CODE=BH.VANID_CODE ' +
' JOIN BL_CONTAINER BC ON BH.BL_NO=BC.BL_NO AND BH.VANID_CODE=BC.VANID_CODE ' +
' AND BC.CONTAINER_NO<>''''' +
' JOIN CONTAINER C ON BC.CONTAINER_NO=C.CONTAINER_NO AND BC.VANID_CODE=C.VANID_CODE ' +
' LEFT OUTER JOIN CUSTOMER_EQ_TYPE CE on BC.VANID_CODE=CE.VANID_CODE AND '
+ ' BC.OPERATOR_CODE=CE.CUSTOMER_CODE ' +
' AND BC.EQUIP_SIZE=SUBSTR(CE.CONVERSION_CODE,1,2) '
+ ' AND BC.EQUIP_TYPE_CODE=SUBSTR(CE.CONVERSION_CODE,3,6) ';
// + ' left outer join CUSTOMER_EDITERM cedi on bc.OPERATOR_CODE = cedi.customer_code '
// + 'and M.TERMINAL_CODE = cedi.TERMINAL_CODE ';
CoarriGroupBySql = ''; function GetFilter: string;
var
filter: string;
begin
filter := ''; edtOperator2.Text := Trim(edtOperator2.Text);
if edtOperator2.Text <> '' then
Filter := Filter + ' and bc.OPERATOR_CODE=''' + edtOperator2.Text + ''''; // edtReceiver2.Text := Trim(edtReceiver2.Text);
// if edtReceiver2.Text <> '' then
// Filter := Filter + ' and bc.TERMINAL_CODE=''' + edtReceiver2.Text + ''''; edtVOYAGE_NO.Text := Trim(edtVOYAGE_NO.Text);
if edtVOYAGE_NO.Text <> '' then
Filter := Filter + ' and sc.VOYAGE_NO=''' + edtVOYAGE_NO.Text + ''''; if filter <> '' then
begin
Delete(filter, 1, 5);
filter := ' where ' + filter;
end; Result := filter;
end;var
iso_Terminal_code: string;
begin
if not ConnectToSrcDB then
Exit; srcTmpQry.Close;
srcTmpQry.SQL.Text :=
'SELECT VANID_CODE, CUSTOMER_CODE, TERMINAL_CODE,TERMINAL_EDI '
+ 'FROM CUSTOMER_EDITERM WHERE '
+ ' CUSTOMER_CODE = ''' + edtOperator2.Text + ''''
+ 'AND TERMINAL_CODE = ''' + edtReceiver2.Text + '''';
//+ 'VANID_CODE = '' & m_sCurrentVanIDCode & '''
srcTmpQry.Open; if not srcTmpQry.IsEmpty then
iso_Terminal_code := srcTmpQry.FieldByName('TERMINAL_EDI').AsString
else
iso_Terminal_code := edtReceiver2.Text; srcTmpQry.Close; qrySrc.Close;
qrySrc.SQL.Text := CoarriSql + GetFilter + CoarriGroupBySql;
qrySrc.Open;//這里出錯數據庫是interbase,一open就出錯,但相關的sql在Interbase Workbench中運行沒有問題.debug時的錯誤信息:
---------------------------
Microsoft Visual C++ Debug Library
---------------------------
Debug Assertion Failed!Program: D:\CargominingDev\DepotEDI\app\DepotEDI.exe
File: dbgheap.c
Line: 1044Expression: _CrtIsValidHeapPointer(pUserData)For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.(Press Retry to debug the application)
---------------------------
中止(A) 重試(R) 忽略(I)
---------------------------獨立運行時的錯誤信息:---------------------------
Microsoft Visual C++ Debug Library
---------------------------
Debug Error!Program: D:\CargominingDev\DepotEDI\app\DepotEDI.exeDAMAGE: after Normal block (#94) at 0x01947988.
(Press Retry to debug the application)
---------------------------
中止(A) 重試(R) 忽略(I)
---------------------------
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货