I have a great example for what you are doing, but i will need to dig through some source code....the above code is from memory and probably not exactly what needs to be done but all-in-all it should get the point across.

Oh and th eproblem is that the DataReader has not been initialized, although you assigned a value. Its a quirk with the DataReaders that have spun me for loops in the past.

My bad, just did a MSDN search....you may want to change the base DataReader class.

Re: Object reference not set to an instance of an object.

Re: Object reference not set to an instance of an object.

Posted 11 June 2011 - 04:04 PM

Quote

Thanks all for your replies
yes I iniciated Modelbuilder_Relation it is a Public ModelBuilder_Relation As ArrayList
In the clean up all I see is that you removed
the empty lines and added 23 at the end of the
oledb.datareader
which I cant figure out why.

Outside of this simplification, you need to verify your connection string cause that seems to be a potential source of your problems. If the connection string returns no data based on your query, then that could be the problem.

Lastly, what .net version are your programming against?

Also, try doing console.writeline(m_dr.GetValue(0)) to see what gets returned during the Read loop. I would start interrupt debugging with Break Points verifying the data objects values, making sure none of them evaluate to 'Nothing'.

Re: Object reference not set to an instance of an object.

Posted 11 June 2011 - 08:01 PM

Quote

Thanks all
As IONUT mention earlier I had forgot to instantiate ModelBuilder_Relation.
At least I asumed I had it wright instead of Dim ModelBuilder_Relation as new Arraylist I had Dim ModelBuilder_Relation as Arraylist. Now it seams to be working