The batch API is driving me crazy! In the past have have got it to work several times. Once in the past I had problems when trying to add rows to the batch but this was explained away with different versions of the software versus SQL server (although I am not sure about that) The problem has now come back and I wonder if anyone else has had it. I have tried using the Blackbaud.PIA.RE7.BatchData instead wherever possible but that does not seem to make a difference. Here is a code snippet: Private Sub ProcessGift(ByVal batchId As Integer, ByVal donor As DonorDetails) Dim batchAPI As New CBatchAPI Dim tempRecords As Blackbaud.PIA.RE7.BatchData._CTempRecords Dim tempRecord As Blackbaud.PIA.RE7.BatchData.CTempRecord 'Dim tempRecord As Blackbaud.PIA.RE7.BBREAPI.CTempRecord 'Dim tempRecords As Blackbaud.PIA.RE7.BBREAPI.CTempRecords Try batchAPI.Init(REUtil.getSessionContext) batchAPI.Load(batchId) 'tempRecords = CType(batchAPI.TempRecords, Blackbaud.PIA.RE7.BBREAPI.CTempRecords) tempRecords = CType(batchAPI.TempRecords, Blackbaud.PIA.RE7.BatchData.CTempRecords) Try tempRecord = tempRecords.Add Catch e As Exception MessageBox.Show(e.Message) End Try AddSingleGift(tempRecords, donor, batchAPI)
On the tempRecords.Add I get the error message: Nothing: Init method must be called before using this object When I compile it and run it in RE (rather than through Visual Studio) I don't get this error but I do get an error when trying to pass it through to the AddSingleGift method: Unable to cast COM object of type 'System.__ComObject' to interface type 'Blackbaud.PIA.RE7.BatchData.CTempRecord'. This operation failed because the QueryInterface call on the COM component for the interface with IID ... failed due to the following error: No such interface supported (Exception form HRESULT: 0x800004002 (E_NOINTERFACE) (I didn't enter the value for the IID as it was too painful) It is as though the object is not being loaded properly from the API. It is seen only as an object of type __COMObject and not its exact type. Any thoughts or suggestions really appreciated. David