|
-
Feb 28th, 2018, 08:44 PM
#1
Re: Connection String
First things first, please don't just post code and say that it doesn't work. I that case, we have to trawl through the whole lot and look for anything that might cause any issue. That's a waste of our time. When you execute that code, something happens. Don't keep that a secret from those whom you want to help you. Most likely, an exception is thrown and that exception has an error message to help diagnose the problem. If you want us to help diagnose the problem, tell us what the error message is and where it happens.
Presumably, there's a NullReeferenceException thrown when you try to get the HasRows property from that 'rd' field that you never actually assign an object to. If you want to use a data reader then you have to actually create one, which you do by calling ExecuteReader on a command. I suggest that you follow the CodeBank link in my signature below and check out my thread on Retrieving & Saving Data for some ADO.NET code examples, including using a data reader.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|