I create with: Code: CArray <Suchparameter*, Suchparameter*> SPA; CArray as a member variable, which is creating problems from without. But when I later pointed so Code: SPA [1] -> getUrl (1); want accessed, the program crashes with exception of the untreated ab.Wenn search parameters I do not grab the array operates in the function.
Hi, Try going in with the debugger and see exactly where he abschmiert. I suspect that you have not used one occupied index or no useful pointers have registered.
He smears from when a member variable of the query parameters to access will.Ich habs also in creating the classes because debuged, is easily resorted to it. So I fill the array: Code: SPA.Add ( new search parameters (val.intVal));
Another approach to error Search: Substitute times Code: SPA [1] -> getUrl (1); by Code: * = Search parameters pSuchTemp SPA [1]; pSuchTemp-> getUrl (1); and look in the debugger's address pSuchTemp and content more closely. If you something strange happens, then you have at least one track. Otherwise, I would need a little more code (but can not tell you how I look at what an accidental).
The program is supposed to, from a database into the array shoveling data, but for some reason is SPA [0] correctly filled not have the program so it changed the array until an item goes through this, I would now runs es.Trotzdem like to know why the program macht.Hier the array is the entire code of the fills. Code: CDaoData base archive; COleVariant val; archiv.Open (" c: \ \ my documents \ \ db3.mdb "); CDaoRecordset r (& archive); r.Open dbOpenDynaset (, " Select ID from query parameters , "dbReadOnly), if ( ! r.IsEOF ()) ( SPA.SetSize (r.GetRecordCount ()); r.MoveFirst (); while (! r.IsEOF ()) ( r.GetFieldValue (" ID ", val); SPA.Add ( new search parameters (val.intVal)); r.MoveNext (); ) ) r.Close (); archiv.Close ();
I can not guarantee that my explanation is correct, but for me there is the as follows: Code: SPA.SetSize (r.GetRecordCount ()); Since you r still no MoveLast () or similar to you, you will not show the real number of lines, special ia a first The lay so an array of size 1 to (your element 0, then that does not work). Below you will: Code: SPA.Add ( new search parameters (val.intVal)); This statement you Haeger exsitierende to the array to a new entry and fill it with "new search parameters ..." . In sum, explains the behavior of your program. Remedy: Either: Make the SetSize r.MoveLast before () and replace this Code: SPA.Add ( new search parameters (val.intVal)) by Code: SPA [iIndex] = new Parameters (val.intVal) , your being you have to make up from 0 duchlaufen loop in iIndex. Or you your savings SetSize (). Then your first causes "Add" the produce of the 0-th element, etc.