|
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).
Josh
Find a penny, pick it up, and all day long you'll have a back-ache...
|
|
|
|
|
Ademola,
can you post the latest code your using. It is difficult to diagnose the problem without the code you are currently trying to run.
In the meantime, try to initialise your connection string using the connection string builder to rule out any typos in connection string.
SqlConnectionStringBuilder conn_str = new SqlConnectionStringBuilder();
conn_str.UserID = "your user_id";
conn_str.Password = "your password";
conn_str.InitialCatalog = "database name";
conn_str.DataSource = "sql server instance name";
conn_str.ConnectTimeout = "connection timeout (as an int)";
SqlConnection conn = new SqlConnection(conn_str.ConnectionString);
Also, make sure you rule out any accidently brain explosions, ie make sure datatable actually has data in it, your connecting to the right database, etc
Dave
|
|
|
|
|
can i fetch null field from database while showing it in textbox on page load event..???
|
|
|
|
|
hi,
How can i locate the form at the buttom rigth off the screen.
I can't do it manually, because the users have defferent screen size or definitions.
Thans for the help...
|
|
|
|
|
Do you mean the form in YOUR application, or ANY application?
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
In my application.
Is there a difference if it's my application or any application?
|
|
|
|
|
Hi,
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.
|
|
|
|
|
Screen currentScreen = Screen.FromRectangle(this.RectangleToScreen(ClientRectangle));
this.Location = new Point(currentScreen.Bounds.Right - this.Width, currentScreen.Bounds.Height - this.Height);
I know nothing , I know nothing ...
|
|
|
|
|
|
Hello,
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
thank you
|
|
|
|
|
Um, have you tried:
errorProvider1.SetError(checkBox1,"Goodbye");
Works for me?
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
johnnysmith1 wrote: but with a checkbox am unsure of how to use
That is dependent on the application of each checkbox.
|
|
|
|
|
Thinking about it more, just what error are you going to show for a checkbox? "This checkbox must be checked?" or "This checkbox must not be checked?"
Smacks of "Do not press this button" buttons to me.
I suspect it would be better for your user if you disable the checkbox when it can't be changed, rather than tell him he did something wrong.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
thank you- you are probaly right- thanks for help
|
|
|
|
|
|
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.
Henry Minute
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.
thanks
|
|
|
|
|
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.
|
|
|
|
|
amitbhatt wrote: others pls ignore this reply n help if they can.
I wouldn't help you if you were the last monkey on this site.
|
|
|
|
|
I agree with Henry. I don't think he was speaking nonsense, and am sure he knows what he is talking about. As you say:
amitbhatt wrote: exe are meant to hide code
Then you say:
amitbhatt wrote: my motive was to understand how things like reflector work
If this was true, you would more likely have started with a piece of your own code, so that you could compare what you found with reflector. I know I would.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
You really know how to make friends and get support. Here are the list of some things you did wrong:
Asked how to steal code in a software developer forum - don't give me crap about "learning"
Insulted someone who gave you an answer when it was not helpful (but was polite)
Tried lying to explain your motives which if true prove you are a fool.
Used text speak - this is not recommended. You have a keyboard try and use it.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
I have two methods in a windows application(am converting to a winservice). I need these methods to run after specific intervals with out user intervention. I have googled a bit and realize that i have 2 main options (correct me if i am wrong).
1. Threading
2. Timer (using TimerCallback)
I have ruled out threading because i want only one thread of execution. I want one of the method to execute at a time.
Timer would execute a method at intervals but my problem is that i want to run 2nd method every 1.5 hour where as the 1st method every 3 hrs. In cases where there is kind a collision method 1 should run first and then method 2. plz note first 90 mins , method 2 runs, 2nd 90 mins both should run but i want method 1 to run and then method 2 can run.
how do i solve such problem. Please provide a solution. Code snippet or idea or web url will highly be appreciated.
Thanx in advance
|
|
|
|
|
I don't believe you can or want to depend on any timer based mechanism to guarantee the order of two notifications. You need to account for that yourself.
Your posted requirements are not specific enough to determine this but perhaps you can have a single timer that fires every 1.5 hours since 1.5 + 1.5 = 3 hours. Therefore every other time it fires you just run both methods in the proper sequence. This could easily be accomplished using a finite state machine design.
|
|
|
|
|
Hi Mike,
Thanx for replying to both of my threads. this project was previously develpd and it had one module in a winservice, which ran after specific interval. to change the interval period and other settings a web application (asp.net) acted like a control panel. When i joined i was assigned to debug the service and add more functionality to it. To add more functionality i added another method. Now requirements are that both methods should run at different time periods but under scenerios where thread 2 and 1 come into conflict , thread 1 should run.
The timing of 90 mins and 180 mins that i mentioned was kinda an example. The timings can be any thing.
Still would i need to use one timer as u said?
Again thanx for ur response and yeah if i use a timer tick event, won't that be loading the whole page every time event is raised. isn't that performance overhead on server?
Thanx again
|
|
|
|
|
One barrier that I am hitting with your problem is the lack of a specification for this:
mark_me wrote: where thread 2 and 1 come into conflict
Without a specific definition for that I don't know that I can provide any meaningful help.
mark_me wrote: would i need to use one timer
Again that depends on the specific requirements. My comment was based on your orignal post of 1.5 + 1.5 = 3 hours. However you have now stated that those numbers are NOT part of the requirements.
|
|
|
|