function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MaxiMizeMaxiMize 

Account()

I'm still pretty new to SSIS, but I've *almost* got things working.  I'm stuck on why I can't create an Account object (called, for example, Acct) as an Array of Accounts.  It continually errors out on that point, saying that the "Object reference not set to an instance of an object.  Here is the code for what I'm doing in that section.  If anyone has any ideas, I'd be most appreciative!


Dim Acct(200) As Account
Dim recCounter As Integer = 0      
      
'Assign values to Update Data
For recCounter = 0 To 200
       Acct(recCounter).Id = SoRec(recCounter).Id
Next
SuperfellSuperfell
dim acct(200) as Account
this will only create the array, it will not put any values in the array, so you have an array of size 200, where each item is NULL.
then you try and set the Id on one of these, and you get a null pointer exception.
You need to create an instance of the account object first, something like.

Dim Acct(200) As Account
Dim recCounter As Integer = 0

'Assign values to Update Data
For recCounter = 0 To 200
Acct(recCounter) = new Account()
Acct(recCounter).Id = SoRec(recCounter).Id
Next
MaxiMizeMaxiMize
Thanks again, Simon.

In the event anyone stumbles in here and is as much of a novice as I, the answer is just as he said.  To modify my code, it would then read:

Code:
Dim Acct As Account = New Account() {}
ReDim Acct(200)
Dim recCounter As Integer = 0     
     
'Assign values to Update Data
For recCounter = 0 To 200
       Acct(recCounter).Id = SoRec(recCounter).Id
Next

 
Hope that is a help to someone...  It does work like a champ now.

-B