If that is your actual code then you have no space character between the last field in the SELECT clause and the FROM keyword in your SQL statement. If that's just a typo then the problem is probably with your connection string. Try calling Open on the connection before calling Fill to check this. Also, unless you explicitly call Open before calling Fill you don't need to call Close. It won't hurt but if the connection is not already open then the call to Fill will open it, use it and then close it again.
So you're saying that the connection gets opened successfully when you call Open but you get an exception thrown when you call Fill, correct? I'd suggest you put the line that throws the exception into a Try block to get as much info as possible:
I used you code and it "worked". I have no idea what the error means though. This is my first real app and I've done very little debugging. Thanks for all of your help and being patient. I attached a SP of the error if your interested in looking at it.
The error message you provided shows that the call to Fill is implicitly trying to open the database connection and is failing. I previously suggested that you try to explicitly open the connection by calling Open on it. It would seem that you did not take that advice. I think you'll find that if you add this line before the call to Fill:
VB Code:
MyConnection.Open()
you will get an exception thrown on that line instead. That would suggest that there is a problem with your connection string.