OE 5.3
IAccpacViewPtr OEORD1header;
IAccpacViewFieldsPtr OEORD1headerFields;
OEORD1header = AccDBLink->OpenView2(_T("OE0520"), NULL);
HRESULT hRes = OEORD1header->Init();
OEORD1headerFields = OEORD1header->Fields;
IAccpacViewPtr OEORD1detail1;
IAccpacViewFieldsPtr OEORD1detail1Fields;
OEORD1detail1 = AccDBLink->OpenView2(_T("OE0500"), NULL);
hRes = OEORD1detail1->Init();
OEORD1detail1Fields = OEORD1detail1->Fields;
IAccpacViewPtr OEORD1detail2;
IAccpacViewFieldsPtr OEORD1detail2Fields;
OEORD1detail2 = AccDBLink->OpenView2(_T("OE0740"), NULL);
hRes = OEORD1detail2->Init();
OEORD1detail2Fields = OEORD1detail2->Fields;
IAccpacViewPtr OEORD1detail3;
IAccpacViewFieldsPtr OEORD1detail3Fields;
OEORD1detail3 = AccDBLink->OpenView2(_T("OE0180"), NULL);
hRes = OEORD1detail3->Init();
OEORD1detail3Fields = OEORD1detail3->Fields;
IAccpacViewPtr OEORD1detail4;
IAccpacViewFieldsPtr OEORD1detail4Fields;
OEORD1detail4 = AccDBLink->OpenView2(_T("OE0680"), NULL);
hRes = OEORD1detail4->Init();
OEORD1detail4Fields = OEORD1detail4->Fields;
IAccpacViewPtr OEORD1detail5;
IAccpacViewFieldsPtr OEORD1detail5Fields;
OEORD1detail5 = AccDBLink->OpenView2(_T("OE0526"), NULL);
hRes = OEORD1detail5->Init();
OEORD1detail5Fields = OEORD1detail5->Fields;
IAccpacViewPtr OEORD1detail6;
IAccpacViewFieldsPtr OEORD1detail6Fields;
OEORD1detail6 = AccDBLink->OpenView2(_T("OE0522"), NULL);
hRes = OEORD1detail6->Init();
OEORD1detail6Fields = OEORD1detail6->Fields;
IAccpacViewPtr OEORD1detail7;
IAccpacViewFieldsPtr OEORD1detail7Fields;
OEORD1detail7 = AccDBLink->OpenView2(_T("OE0501"), NULL);
hRes = OEORD1detail7->Init();
OEORD1detail7Fields = OEORD1detail7->Fields;
IAccpacViewPtr OEORD1detail8;
IAccpacViewFieldsPtr OEORD1detail8Fields;
OEORD1detail8 = AccDBLink->OpenView2(_T("OE0502"), NULL);
hRes = OEORD1detail8->Init();
OEORD1detail8Fields = OEORD1detail8->Fields;
IAccpacViewPtr OEORD1detail9;
IAccpacViewFieldsPtr OEORD1detail9Fields;
OEORD1detail9 = AccDBLink->OpenView2(_T("OE0504"), NULL);
hRes = OEORD1detail9->Init();
OEORD1detail9Fields = OEORD1detail9->Fields;
IAccpacViewPtr OEORD1detail10;
IAccpacViewFieldsPtr OEORD1detail10Fields;
OEORD1detail10 = AccDBLink->OpenView2(_T("OE0503"), NULL);
hRes = OEORD1detail10->Init();
OEORD1detail10Fields = OEORD1detail10->Fields;
//prepare view array for compose
aDim[0].cElements= 6;
SAFEARRAY FAR * TempArray = SafeArrayCreate(VT_VARIANT,1,aDim);//1D SafeArray VARIANTS
aLong=0;
SafeArrayPutElement(TempArray, &aLong, OEORD1detail1);
aLong++;
SafeArrayPutElement(TempArray, &aLong, OEORD1detail4);
aLong++;
SafeArrayPutElement(TempArray, &aLong, OEORD1detail3);
aLong++;
SafeArrayPutElement(TempArray, &aLong, OEORD1detail2);
aLong++;
SafeArrayPutElement(TempArray, &aLong, OEORD1detail5);
aLong++;
SafeArrayPutElement(TempArray, &aLong, OEORD1detail6);
VARIANT *vTemp = new VARIANT;
vTemp->vt = VT_ARRAY|VT_VARIANT;
vTemp->parray = TempArray;
OEORD1header->Compose(vTemp);
//....
//-- removed the other views composition but it is exactly like this Macro:
OEORD1header.Compose Array(OEORD1detail1, OEORD1detail4, OEORD1detail3, OEORD1detail2, OEORD1detail5, OEORD1detail6)
OEORD1detail1.Compose Array(OEORD1header, OEORD1detail7, OEORD1detail10, OEORD1detail8)
OEORD1detail2.Compose Array(OEORD1header)
OEORD1detail3.Compose Array(OEORD1header, OEORD1detail1)
OEORD1detail4.Compose Array(OEORD1header, OEORD1detail1)
OEORD1detail5.Compose Array(OEORD1header)
OEORD1detail6.Compose Array(OEORD1header)
OEORD1detail7.Compose Array(OEORD1detail1)
OEORD1detail8.Compose Array(OEORD1detail1, OEORD1detail9)
OEORD1detail9.Compose Array(OEORD1detail8)
OEORD1detail10.Compose Array(OEORD1detail1)
//----
vTemp->vt = VT_BSTR;
vTemp->bstrVal = bstrCustomerNumber
OEORD1headerFields->GetFieldByName("CUSTOMER")->PutWithoutVerification(vTemp);
//the PutWithoutVerification crash
//the put_Value returns -2147467259
I compared to the RV spy result with the macro and my code and here is what i get with the PutWithoutVerification :
----------------
[1494] AR0016: ARRTA [15:34:41.46].Load
[1494] AR0016: ARRTA [15:34:41.48].InstanceOpen(PIB=2001, link=177, flags=0x00000040, size=0, buffer='')
[f6c] --LINK-177: 15:34:41.48 OPEN-TABLE ( table=ARRTA , flags=1 )
[f6c] --LINK-177: 15:34:41.50 handle <-- 31
[f6c] --LINK-177: 15:34:41.50 GET-TABLE-INFO ( table=ARRTA )
[f6c] --LINK-177: 15:34:41.50
[f6c] --LINK-177: 15:34:41.50 GET-DRVR-INFO ( )
[f6c] --LINK-177: 15:34:41.51
[1494] 0 <==[15:34:41.51;t=30;ovh=0] {view=0x09a2da74}
[1494] AR0016: ARRTA [15:34:41.51].Name(view=0x09a2da74, field=999999998 <TITLE_IDX>)
[1494] 0 <==[15:34:41.51;t=0;ovh=0] {name=' ', desc='Terms Codes '}
[1494] AR0016: ARRTA [15:34:41.51].Put(view=0x09a2da74, field=1, size=6, verify=0, buffer='\32\4e\33\30\20\20' -> '2N30 ')
[1494] 0 <==[15:34:41.51;t=0;ovh=0] {}
[1494] AR0016: ARRTA [15:34:41.51].Read(view=0x09a2da74)
[f6c] --LINK-177: 15:34:41.51 GET ( handle=31, keyno=0 )
[f6c] --LINK-177: 15:34:41.54
[1494] 0 <==[15:34:41.54;t=30;ovh=0] {}
[1494] AR0016: ARRTA [15:34:41.54].Get(view=0x09a2da74, field=2, size=60)
[1494] 0 <==[15:34:41.54;t=0;ovh=0] {buffer='\32\25\20\2d\20\31\30\20\64\61\79\73\2c\20\4e\65\74\20\33\30\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20' -> '2% - 10 days, Net 30 '}
[1494] AR0016: ARRTA [15:34:41.54].Get(view=0x09a2da74, field=6, size=2)
[1494] 0 <==[15:34:41.54;t=0;ovh=0] {buffer='\00\00'}
[1494] 1 <==[15:34:41.54;t=3595;ovh=1804] {**ERROR**}
----------------
The same error occur with Put_Value, except i dont get the Unhandled exception in application : 0xC0000005: Access Violation
I'm not sure about my arrays, so please let me know if you have any comment or idea,
THANKS
Jo