I want the data stored in database to be displayed from the first record in the database. These data were submited to the database via textbox and I want to load the first record from database and display in the textbox.
below are the codes that I have check Beginners guide to accessing SQL Server through C# but can't still do it. No error but dont know what to do. Please I need help on this
Your connection string is wrong to start with. If you supplied a username and password you do not use TrustedConnection.
The rest of the code looks reasonable, so long as the SQL statement is correct and there's data in the Company_Info table, and the column names are correct.
I have removed the trusted connection but can not still retrieve from the database. All I want is onformLoad it should get the record from database and display it in textbox.
Expecting your reply
When I am working with a datareader, I always try and make sure that I actually received a datareader back from the ExecuteReader() call (ie "if(myReader != null)". I also check the HasRows property on the datareader object to verify that I have results to loop through. The way this is coded now, the while loop will read each record from the datareader. If data from the first row is all that is needed, calling myReader.Read() by itself will just read the first row (instead of using the while loop).
Find a penny, pick it up, and all day long you'll have a back-ache...
you can find out what screen you are using (when on a multi-monitor setup), get its resolution, then position the form appropriately. You would need the Screen class (maybe GetWorkingArea() method), and set the Form's StartPosition and Location properties.
BTW: you may have to take the selectable behavior of the task bar into account.
PS: for other apps, you would need to send Window messages and/or call Win32 API functions.
Luc Pattyn [Forum Guidelines][My Articles] DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
I want to use the errorprovider control with checkboxes I have on a form.
I know with a textbox:
you can use something like if (textbox.text = <=0)
errorprovider.seterror(textbox,"you must enter data");
but with a checkbox am unsure of how to use
If the author of the tool you have downloaded doesn't make the source available, my guess is that they don't want you to have it.
You shouldn't really ask people who write code for a living to help you steal it.
If you are unable to copy the GUI and unable to put the code together by using reflector, I doubt very much if you have the ability to code such an application, even if someone told you how to do the GUI.
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
mind ur language. my motive was to understand how things like reflector work. if u don't have the answer at least don't speak nonsense and discourage people. exe are meant to hide code. and reflector to experiment with the same. ur answer shows ur incapability to understand the problem n solve the same. stop doubting others capabilities when u urself don't know.
others pls ignore this reply n help if they can.
I won't ignore that reply, it was extremely rude and disgusting at best, and uneducated and reflected your level of knowledge at the least.
Mind your language, and do conduct yourself accordingly. You are the one asking for help from us after all. If you don't like an answer from someone, ignore it. Don't insult. And by the by, you'd be lucky to get an answer form Henry Minute again, he's extremely helpful around these boards, try to show him the utmost respect.