oracle - Printing data from an OleDbDataReader in C# -
basically debugging purposes want print contents of oledbdatareader object console, struggling find away of doing it. me out please. have no way of testing sql (well can in toad oracle thats not point).
ideally going transfer contents of in arraylist if exist in c# (i new c# may have guessed!)
while (myoledbdatareader.read()) { console.writeline(...) }
for every field in sql-query, can data typing
string test = myoledbdatareader["fieldname"].tostring();
for example can print with:
console.writeline(myoledbdatareader.["fieldname"].tostring());
you can try this
foreach(var item in myoledbdatareader) { console.writeline(item.tostring()); }
to print out every included item. (not tested!)
edit: forgot have put foreach-loop
in while(reader.read())
-loop or won't work...
edit2:
better loop:
(int k = 0; k < reader.fieldcount; k++) { console.writeline(reader[k].tostring()); }
Comments
Post a Comment