|
Thanks, but, No, I'll just try to suffer like the rest of us.
|
|
|
|
|
To clarify more (I hope); you can hold the Connection instance for the duration of your application, but only open it when you need it then close it. That's what I do, even with Windows Services that run 7x24 forever. And also use connection pooling.
It's really very easy, if you think it's difficult then you must be doing it wrong. You can check out this fine article[^], or use a DataAdapter (which I don't recommend).
|
|
|
|
|
I am trying to rename a file with File.Move() method. I get an exception on my File.Move() code. the exception is like "The file is already exists|r\n"
I have checked if the file exists or not. The file exists.
string fileToRenamePath = RMAConfig.PDFPath + this.rmaObjSum.RMANum + RMAConfig.Extension;
string fileRenamedPath = RMAConfig.PDFPath + "[Return Documentation" + rmaObjSum.RMANum + "]" + RMAConfig.Extension;
File.Move(fileToRenamePath, fileRenamedPath);
I worked it around instead of using File.Move() method;
I have used:
File.Copy(fileToRenamePath, fileRenamedPath);
File.Delete(fileToRenamePath);
But i am curious why did i get an exception while i was trying to rename the file by using the File.Move() method.
|
|
|
|
|
"The file already exists" means that the filename you're trying to rename the file TO already exists, not the file your renaming.
|
|
|
|
|
oh yeah you are right, carelessness.
|
|
|
|
|
Hi All, I need to display my assembly version on about form. I am not quite sure how get it and display on a label. if know please let me know.
thaks,
|
|
|
|
|
Google says...
System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
...you can determine the version of your application in the AssemblyInfo.cs file which may be found in the Properties folder of your solution (VS 2010)
EDIT: Slight correction of Google found code
Illogical thoughts make me ill
|
|
|
|
|
Thanks for your reply. I already have gotten it, google is the best friends of mine since I started programming. I still don't get it why I am getting asm version
1.0.0.0 where I see is 1.0.7. I have a installer what does it means project and installer will have two different assembly version.
thanks,
|
|
|
|
|
In your solution you will find a file called AssemblyInfo.cs in the properties folder. This file will contain an "AssemblyVersion" property which determines the actual version of the assembly (this will be the value you get if you use my suggested code)
I don't use VS for installers but I imagine the installer version is simply there as a sort of "release version" value - i.e. it is up to you to pick this, and would probably make sense for you to set it the same as your assembly version (this paragraph is speculation as I said I do not use VS installer wizard thingy)
e.g. you may choose to have the following...
Assembly Version = 1.2.3.4
Installer Version = 1.2 (don't need to show the rest is you only ever release minor build changes)
Illogical thoughts make me ill
|
|
|
|
|
You can get the version for the application with Application.ProductVersion[^].
For an individual assembly you can use something like
Assembly.GetExecutingAssembly().GetName().Version
which may, or may not give the same result as the first suggestion.
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.”
I wouldn't let CG touch my Abacus!
When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is.
|
|
|
|
|
The are two version properties in the AssemblyInfo.cs file...
AssemblyVersion - which is returned by your second suggestion (code)
AssemblyFileVersion - which is returned by your first suggestion (link)
Illogical thoughts make me ill
|
|
|
|
|
Which may, or may not be the same, depending on how they have been set.
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.”
I wouldn't let CG touch my Abacus!
When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is.
|
|
|
|
|
...Oh I see, that was a statement of knowledge rather than of query
Illogical thoughts make me ill
|
|
|
|
|
See here[^] for sample code to extract the details.
I must get a clever new signature for 2011.
|
|
|
|
|
Hi,
Can you let me know the sample to create xml file using SAX parser. Thanks in advance
|
|
|
|
|
You were told here[^] that .net doesn't use a SAX parser out the box. The equivalent is XmlReader , but this only reads. You can use XmlDocument , XmlWriter to write or you can directly serialize/deserialize and object. Which is easiest depends upon what is exactly needed.
|
|
|
|
|
I have an vs2008 Installation package, and i want to create a patch for it.
Please cand somebody help me out?
Thank you.
|
|
|
|
|
how i can find cd is readable and dvd is writable or not
and how reset these properties.
plz explain with example.
thanx ...............
|
|
|
|
|
Aisha sharma wrote: plz explain with example
...plz explain with question
Do you mean actual CD/DVD or Drives?
And what do you mean by 'reset these properties'?
Illogical thoughts make me ill
|
|
|
|
|
yes i want get information about actual cd and dvd e.i.
cd/dvd readable or writable
and want to give rights to user so that he can block
readOnly or writeOnly accesstypes
|
|
|
|
|
Hi there,
I've got a real annoying issue with an extremely simple .net application (C#, .net3.5).
What I have is a simple program (comparable to Hello World) which launches a thread to periodically read an xml file and stores some values into memory which are used by the main app thread. The main application thread just looks for mouse events on a traybar-icon which open a webbrowser with a specific url. That's it.
What the problem is, is that on my dev-machines and home computers the app runs nicely for hours/days straight. On my work-pc, the application seems to enter in a blocked state on the main execution thread or it enters a deadlock/filelock or something after a few minutes and stops responding and the process has to be killed via the taskmanager. This only happens on my work-machine which is Windows XP with .net4.0 installed. All other machines are also windows XP (any flavor) with .net3.5 installed. No error windows or logging present.
I'm at a total loss here. I ran through the code numerous times and checked all IO/Threading routines, but no loose ends found. Any ideas what it might be? Could it be the 4.0 runtime? (which I seriously doubt)
A good programmer is someone who always looks both ways before crossing a one-way street. (Doug Linder)
|
|
|
|
|
there is insufficient information.
is it a WinForm app? if so, is another thread trying to access some of the Controls?
do you have proper exception handling? are all exceptions caught and logged? are you swallowing some?
when it blocks, is the CPU load near zero? or rather near one fully occupied core?
Helfdane wrote: an extremely simple .net application
so why not show all relevant code?
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Fair questions, my bad for the insufficient info. I can't access the sources from this machine and I'm not going to type it over
It's a windows application. The values read from the xml are used to populate a context menu on a traybar icon. So, there is the main app-thread which reads values from a class (GetValues()) and uses those values to build a contextmenustrip. There is one thread which reads an xml-file and stores the values into memory (properties of the value-class). (polls an xml file for updates)
Cpu load is 0% at all times, the application is too small to notice it on a dualcore. Memory usage is 21kb.
But if this was a logic-issue, I should have problems on all machines, not just one of the 5. The only thing different between those machines is that the one machine which hangs the app has .net4.0 runtime installed, the others are still on 3.5. So, hence my question
A good programmer is someone who always looks both ways before crossing a one-way street. (Doug Linder)
|
|
|
|
|
As you are not touching any GUI parts from a thread other than the main thread, it sounds like a deadlock; you seem to have a producer-consumer relation between two threads, possibly there is insufficient synchronization. Maybe you are sharing several data items, and a thread switch occurs when the shared data is in an inconsistent state. Maybe you allowed for a compiler optimization that isn't correct (e.g. lacking a volatile keyword).
OTOH there have been some synchronization changes in .NET 4.0, IIRC they had to adapt a few things to cope with some potential deadlock the way things used to be handled internally. There also is a new "cancellation model". I don't have a reference, and I never saw an actual victim of the old ways. This[^] is something a quick Google brought up, not sure it is related though.
I would consider it more likely the problem is in your code itself. It working properly all the time on some machines, and quite some time on the one, does not prove a thing. Bugs don't have to show themselves all the time, that would be too easy...
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Thanks for the tip. I'll take a look at it.
A good programmer is someone who always looks both ways before crossing a one-way street. (Doug Linder)
|
|
|
|