|
PosiRob wrote: The application in this combination is usualy lightning fast, but after a certain period of inactivity (say 30 minutes) the application takes forever (say 60 seconds) for it's first response
60 seconds it way to much for database connection problem. What OS are you using? I Know that Vista and Win7 has properties in advanced power management for IDLE HDD. That option make HDD shut down if nothing was read or write on it after period of time. Before I Discovered this setting my HDD needed approximately 1 minute before I could start using it
|
|
|
|
|
Thanks for this answer, my clients run mostly on XP, but it's not impossible that XP also has these "features".
I have XP/Vista and Windows 7 so I can investigate this theory, thanks for thinking
Rob
PS, I marked question by accident as solved. Other suggestions are still welcome.
|
|
|
|
|
Hello. I Just checked about that options, and it exists in WinXP. Under Screen saver tab, there are settings for power options.
I do remember this on Vista, because it was set to default to 15 minutes. And i have about 4 internal HDDs. And every time I attempted to access HDD after 2 hours of inactivity I got a very big system LAG due to HDD powering on. However I don't remember it affected HDD with OS installed on it
|
|
|
|
|
The swap can be a problem. Try disabling virtual memory to see if this behavior changes.
The connection to the database being lost could also be a problem. You may want to execute some "keep-alive" command from 30 to 30 seconds to see if this stops happening.
Also, the HD being power off can be a problem. But, have you noticed this in other applications running in that computer?
|
|
|
|
|
Thanks for the suggestions. The client computers usually only run my application so I can't say if other applications face the same problem.
Excuse my ignorance, but do you have an example of a keep alive command ?
Thanks for your time.
Rob
|
|
|
|
|
PosiRob wrote: do you have an example of a keep alive command ?
Yes: SELECT 1
I think what he means by a "keep-alive command" is simply *any* command executed for the purpose of keeping the connection alive, not a special command.
Be aware that if you are using connection pooling, calling Close() does not actually close the connection to the database (it simply returns the connection to the pool). A whole minute to re-establish the connection sounds like a lot, but then I don't know anything about your environment or how you connect to the database.
|
|
|
|
|
Exactly. The keep alive command is only a command to be executed, that will not cause any data changes and is fast. It will only force the connection to be used.
|
|
|
|
|
Hi,
Is there any way to show "Press any key to Continue" message end of the run VS Console application.
|
|
|
|
|
yakupc wrote: Is there any way to show "Press any key to Continue" message end of the run VS Console application
Within Visual Studio if you start debugging with Ctrl-F5 it will do it automatically.
When you run your program outside this environment you will need to code it yourself (Console.Write and Read ).
|
|
|
|
|
By default, "Ctrl+F5" is mapped to "Start Without Debugging"
|
|
|
|
|
worked.It is great.Thank you so much.
|
|
|
|
|
Console.WriteLine("Press any key to Continue");
Console.ReadKey();
the second statement is optional.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
And a less user-friendly variant:
while (true)
{
Console.WriteLine("Continue to press any key.");
Console.ReadKey();
}
|
|
|
|
|
Alternate implementation. I actually think the other solution is better, but I was curious if this would work (and it does). Note that UseShellExecute is important, otherwise the process is opened in a new window. The disadvantage is that you're more tightly coupled with the OS (i.e. it wouldn't work under Mono on a non MS-platform)
using System.Diagnostics;
ProcessStartInfo psi = new ProcessStartInfo("cmd", "/c pause");
psi.UseShellExecute = false;
Process.Start(psi).WaitForExit();
|
|
|
|
|
Or run it from a BAT file.
myapp.exe
pause
|
|
|
|
|
@echo off
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
I didn't want to confuse the reader with such details.
|
|
|
|
|
Hi All, I am facing a problem when I try to insert into sqlite database.
sql_cmd.CommandText = "INSERT INTO test('name')VALUES ('Value2')";
it is giving me error saying test table does not exist but in reality it does.
can you please tell me what I am doing wrong.
thanks in advance.
|
|
|
|
|
Have you asked or looked here[^]
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Message Closed
modified 23-Nov-14 7:25am.
|
|
|
|
|
Hi stancrm, I did try it but did not work. I try also other suggestion too. Nothing is working.
Thanks for you help. if you know anything else I will give a try.
thanks
|
|
|
|
|
Hi All,
Try to run this command in sql server u will come to know what is the problem.
Thanks,
Amit Patel
|
|
|
|
|
I believe that column-names aren't enclosed in quotes;
sql_cmd.CommandText = "INSERT INTO test (name) VALUES ('Value2')";
I are Troll
|
|
|
|
|
Hi all!
I'm trying to get the use ratio of the network , just like the network used(eg. 0.01%) in the task manager.
I tried to realize that through using ManagementClass,but failed.Would you like to show me how to realize that?
Thank you!
--------------------------------------
ManagementClass mc = new ManagementClass("Win32_NetworkAdapter");
ManagementObjectCollection moc = mc.GetInstances();
foreach (ManagementObject mo in moc)
{
string a = mo["Speed"].ToString();//mo["Speed"] is NULL
Console.WriteLine(a);
}
|
|
|
|
|
Message Closed
modified 23-Nov-14 7:25am.
|
|
|
|