So I have created an auditor that executes a query where I get some values from the table, however when I get this data I try to show in an amboxa (only temporary) I can only show the first value and as soon as I try to get a second set of values, it does not give me this error object reference to set an object instance .
The code is as follows
Public Zero Belgrade Grow () {List & lt; Int & gt; Groepresrace = new list & lt; Int & gt; (); OraclePamator [] Beyond = New OracleParamator [10]; // Mate Flexibel version Gematour Oracle data reader oDRDER = DBC connection Select (select "GROEPRESERVERING_ID, BETAlad for gratifying", bettal); ODReader.Read (); (Int x = 0; x & lt; 2; x ++) for {message box. Show (ODReader ["GROEPRESERVERING_ID"]. ToString ()); MessageBox.Show (ODReader ["BETAALD"] ToString ().); ODReader.NextResult (); }}
Now my qeuistion is how can I show each set of valaces instead of the first time?
ODReader.NextResult ();
will return the next "result set" to your query, in your query you have just one single SELECT
statement, so that you will end up with a result set. Since there is no other result set, when you try to reach ODReader ["GROEPRESERVERING_ID"], ToString ()
gets an empty reference exception.
What you should do, get the next line from your results set. Use
ODReader.Read ();
to reinvent the next result set. If you want to restrict two rows only by using the result set yourself:
OracleDataReader ODReader = DBConnection.Select ("Select GrEPRESERVERING_ID, BetaEld from GROEPRESERVERING", Bettold); Int counter = 0; While (ODReader.Read () & amp; amp; Counter & amp; 2) {MessageBox.Show (ODReader ["GROEPRESERVERING_ID"]. ToString ()); MessageBox.Show (ODReader ["BETAALD"] ToString ().); Counter ++; }
Comments
Post a Comment