My idea is to create a class "DataReader" with a method "Read". The parameters will be an Array of "database field names", a corresponding ArrayList of "local data members" to copy into, and the querystring.
Cars aCar = new Cars();
ArrayList localObjects = new ArrayList{aCar.Model, aCar.Color, aCar.Year};
string [] dbFieldNames = new string [3] {"carModel", "carColor", "carYear"};
DataReader reader = new DataReader(connectionString);
DataReader.Read(dbFieldNames, localMembers, carsQueryString);
My issue is, when objects are added to an ArrayList, really what's added is their value, not the memory location of the objects themselves. So, when changes are made to the objects in the ArrayList, these changes are not reflected on the original objects which were added.
I'm pretty sure I could add pointers to the Arraylist instead, but I'd rather not resort to this if there's a better way. Much appreciated for any help!
This is an ASP.NET program, but the code I've posted is all C#. So, if it needs to be moved, sorry about posting in the wrong section.

New Topic/Question
Reply




MultiQuote




|