Database function skipping data
Hello, when I run the below method it is supposed to return a string array with a list of users, but when I run the debugger, the reader object has rows, but it skips over the while loop. Here is the code:
4 Replies
.Append
doesn't modify the source array
you want to use a List<string>
instead and call .Add
this code doesn't look like it should compile at all, you declare string[] user = null;
then try to append to something called users
Sorry, I miss typed the variable, it is users
so you have 2 issues
the one i mentioned, and trying to call methods on a null reference
I am working on this for a school project and have to use a virtual machine so I can't copy code from it to my machine
Okay, so I have changed the above to what I have and that worked, thanks for your direction.