|
dojohansen, thanks for reply.
Looks like these classes are private to .NET framework itself and therefore can not be accessed from user code.
Anyway, all I need is an advice of how to retrieve the DataSet fields at design-time from property editor.
I'd appreciate any help on this
|
|
|
|
|
Does anyone know if its possible to select table column names in c#.
I want something like
while dtr.read()
{
combo.items.add("dtr column name");
}
|
|
|
|
|
Your question is rather incomplete.
From your code it seems you'd like to get the column names of a result set from an open data reader. Whether or not you can do that depends on the reader implementation (there's nothing in the IDataReader interface for it). Check the documentation.
In any case, why would you WANT to get it from the reader!? You should presumably know what data you're getting!?
Depending on the database you might be able to use the INFORMATION_SCHEMA built-in views:
SELECT * FROM [INFORMATION_SCHEMA].[COLUMNS] WHERE [TABLE_NAME] = 'MY_TABLE';
Or you might use a data adapter instead of the reader directly (though it uses a reader internally, so it apparently has a way of getting schema information from the reader!).
Or you might rephrase your question...
|
|
|
|
|
Hi experts,
I would ask you how I can manage the properties of my sound device by C#.
At the moment I am using winmm.dll and I am able to set the volume but I also want to check if the sound is enable or not.
Thanks,
Antonio
|
|
|
|
|
Hi all.
I am currently facing a problem using HttpWeb Request ,
I iam able to download the attachments ,but the text message i am getting is in the format http://host/share/1_.000
but how to read the text message when it comes in this format ,
The attachments are of the format http://host/share/file.doc,I am able to get the stream and construct the file .
but if i dont have any attachment and have only the text message how can i read such messages.
any help in this regaurd will be appreciated
thank you
manju
Hi..
I am Mnaju.I have Completed my B.E Computers Science.Lokking for a job.I am interested in VC++
manju
|
|
|
|
|
I have a question.
I have created a console application. It reads OPC Variable in loop.
If I started the application, it takes about 18000K of memory. If I
click at minimize button, it reduce the memory usage to 3000K.
But if I call "GC.Collect()", the memory usage will not be reduced
to 3000K. It happens only during minimizing.
If I maximize the window again, the memory usage still at 3000K-5000K.
Are there any code to reduce the memory usage without minimizing ?
Because it not happens, if I call only "GC.Collect()".
Thanks...
|
|
|
|
|
As far as i know, when you do something like GC.Collect(); your not telling the garbage collector to collect the object, your merely flagging that object for garbage collection. So when the garbage collector comes along(at a later point in time) it will collect the object you flagged.
If you post your code(specifically the loop) we might be able to get the memory usage down a bit...
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.Passion != Programming & you.Occupation == jobTitles.Programmer)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
You're not flagging anything with GC.Collect. You're just telling the GC you'd LIKE a garbage collection to occur at this time. But, it's up to the GC if it wants to do it or not. When a collection runs, your app stops while the GC walks the heap looking for objects that need to be collected.
|
|
|
|
|
I believe it's not actual memory usage that you're seeing in Task Manager - just memory that Windows has pre-allocated to your app. Any memory allocated but unused will be reclaimed if needed elsewhere or when minimized which is why you're seeing those figures.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
You may want to try GC.WaitForPendingFinalizers() as well. It's a perfomance killer and not recommended in most situations, but it could be interesting to see if it changes the memory usage you see in task manager.
|
|
|
|
|
Learn how memory work under the .NET CLR.
What you're seeing in Task Manager, which is a lousy place to look for memory usage by the way, you're seeing what memory the .NET CLR has reserved for your app. Your app may not be using all of this memory, but it's sitting in the .NET CLR Managed memory pool, waiting for your app to allocate some memory for objects or whatnot. When you minimize your app, the .NET CLR looks to see if there is any memory in the Managed Pool that isn't being used by your app and, from what it can tell, isn'tgoing to be used anytime soon. If so, this memory is taken out of the Managed Pool and returned to Windows.
Basically, you're worried about nothing. The .NET CLR is very good at managing it's memory and cooperating with Windows. If Windows needs memory back from the .NET CLR, the CLR is more than happy to scan it's pools to see what it can return to Windows.
...entirely automatically. You don't need to do anything.
|
|
|
|
|
Dave Kreskowiak wrote:
What you're seeing in Task Manager, which is a lousy place to look for memory usage by the way, you're seeing what memory the .NET CLR has reserved for your app. Your app may not be using all of this memory, but it's sitting in the .NET CLR Managed memory pool, waiting for your app to allocate some memory for objects or whatnot.
Expanding upon this; The CLR does it because asking for more memory from the kernel is an expensive operation, it's much faster to ask for a large block up front than to keep asking for little bits as needed. Also when system memory starts getting low, windows will go around asking applications if they can return extra unused memory. When this happens the same thing will occur as when you minimize the application.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
//below is my code , i want to add one entry
System.Configuration.Configuration config =
ConfigurationManager.OpenExeConfiguration("AppDomain.CurrentDomain.BaseDirectory +"..\\..\\App.config");
// Get the count of the Application Settings.
int appStgCnt = config.AppSettings.Settings.Count;
string asName = "AppStg" + appStgCnt.ToString();
// Add an Application Setting.
config.AppSettings.Settings.Add(asName,
DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString());
// Save the configuration file.
config.Save(ConfigurationSaveMode.Modified);
// Force a reload of a changed section.
ConfigurationManager.RefreshSection("appSettings");
but instead of writing in app.config , it creates another app.config.config file, so why is it so??????
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
modified on Tuesday, September 16, 2008 5:02 AM
|
|
|
|
|
Mogaambo wrote: System.Configuration.Configuration config =
ConfigurationManager.OpenExeConfiguration("..\\..\\App.config");
is this path valid? Try to give full executable path or use the other overload ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel)
|
|
|
|
|
Yes it is, if i give wrong path then it gives error,
i used this way
(AppDomain.CurrentDomain.BaseDirectory + "..\\..\\App.config")
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
|
|
|
|
|
Check out this on MSDN[^]. It has an example doing what you want. The main page is in VB but scroll down to the community content section and someone has posted a C# translation. I've just tried it and it works.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
//I tried this code but the result is not reflecting in app.config
//WHY
// Get the configuration file.
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
// Add an entry to appSettings.
int appStgCnt = ConfigurationManager.AppSettings.Count;
string newKey = "NewKey" + appStgCnt.ToString();
string newValue = DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString();
config.AppSettings.Settings.Add(newKey, newValue);
// Save the configuration file.
config.Save(ConfigurationSaveMode.Modified);
// Force a reload of the changed section.
ConfigurationManager.RefreshSection("appSettings");
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
|
|
|
|
|
Sorry about that - my bad! That example uses yourexename.config if release or yourexename.vshost.exe.config if debug.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
Because it's Microsoft. They provide HUGE amounts of stuff but none of it actually works properly.
|
|
|
|
|
I had set the DetectUrls property of the richtextbox object to true. When I typed an URL address, the address would be automatically underlined and the color of the font would be in blue and when ever I move the cursor over the address, it will change from an "I beam" to a "hand".
However, when I clicked the url, nothing happened. I expected the Internet Explorer 's window to pop out. Can anyone tell me what should I do ?
|
|
|
|
|
Use the LinkClicked event of the RichTextBox and put in something like this:
System.Diagnostics.Process.Start(e.LinkText);
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
|
You're welcome
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
|
what?
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.Passion != Programming & you.Occupation == jobTitles.Programmer)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|