|
And the problem is...?
---
b { font-weight: normal; }
|
|
|
|
|
I don't seem to see a question in your message? What's your problem exactly? Your code is one way of doing it. What's wrong with it?
Ps.
Make sure to call writer.Flush() at the end of your code before slocing the stream.
Regards
|
|
|
|
|
Doesn't Close flush the stream?
|
|
|
|
|
Well, in his case Close() will flush the FileStream , but not the BinaryWriter . So I suggested that he'd call writer.Flush() to flush the BinaryWriter too.
Regards
|
|
|
|
|
But he's closing the writer. That flushes the writer, closes the writer, flushes the stream and closes the stream.
---
b { font-weight: normal; }
|
|
|
|
|
IIRC he called
w.Close();
and w is the FileStream. How does that close the BinaryWriter -named in his code writer -?
Regards
|
|
|
|
|
Yes, you are right in that. I didn't read the code thorougly enough, and was confused by the naming of the variables and what the code really should have been doing. He closes the stream when he should really close the writer instead.
The best way is of course to close the writer, not the stream:
writer.Close();
If you close the stream, you can solve the problem with the buffering in the writer by flushing the writer first, but it still leaves the writer in a confused and unusable state when the stream is closed.
---
b { font-weight: normal; }
|
|
|
|
|
Hi
I want to get sql server table fields Description, I want to use them for my datagrids header text.
So how can i get field description from database table?
Tanks
|
|
|
|
|
freshonlineMax wrote: I want to get sql server table fields Description
What makes you think there ought to be one? Take a look at DataColumn class in your documentation, you'll see it has no description member. I usually name my columns in the database in a human friendly way so that I'd name the DataGridColumns with the same string using a loop -with some modifications of course like removing underscores-.
Regards
|
|
|
|
|
Just because the DataColumn class doesn't have such a property doesn't mean there is now way to get this info...
Robert
|
|
|
|
|
Robert Rohde wrote: doesn't mean there is now way to get this info...
And what other ways do you know to get that information? Also when you make a Sql table where do you put that information?
Regards
|
|
|
|
|
Dear Nade Elshahabi
Please don't answer your friend's questions with an another question and let others to help and show the best way.
I had a code to fetch database informations, but i lose it in my harddisk.
If you don't have information about a subject you don't have to answer.
I know you want to help, but others me be think, my problem have been solved.
Regards
|
|
|
|
|
freshonlineMax wrote: Please don't answer your friend's questions with an another question
I wasn't asking for an answer. I was proving my point of view that there is no description for Sql columns. If Robert knew how to get it he would have posted the answer. BTW where did you put that description anyway?!!
freshonlineMax wrote: I had a code to fetch database informations, but i lose it in my harddisk.
Database information?? You mean that present in the INFORMATION_SCHEMA? Check the INFORMATION_SCHEMA.COLUMNS table and see if it has a description field!!
freshonlineMax wrote: If you don't have information about a subject you don't have to answer.
freshonlineMax wrote: I know you want to help, but others me be think, my problem have been solved.
Sure! And forgive me -turely- if I blocked someone else from answering you. Your post is still there. He who has answer, let him benefit us all!!
-- modified at 14:26 Saturday 28th October, 2006
Regards
|
|
|
|
|
Hello Again
Dear friend 'Nader Elshehabi'
I solve my problem my self!
Now i can help myself, you(if agree) and others (if it's useful!)
Just run below query in sqlServer:
SELECT objtype, objname, name, value
FROM ::fn_listextendedproperty(NULL, 'user', 'dbo', 'table', 'YourTablename', 'column', DEFAULT) AS fn_listextendedproperty_1
If we want to get special column's description, we should type column's name instead of 'DEFAULT'. Field 'value' refers to column's description.
Regards
|
|
|
|
|
Hi,
maybe this[^] is a good start.
Robert
|
|
|
|
|
you can retrieve data from SQL select :
select b.name,c.value from syscolumns b, sysobjects A,sysproperties c where a.name ='bed' and a.id=b.id and b.id=c.id and b.colorder=c.smallid
then use this rows to modify your datagridview column tex
if you can design this, i may design class for you:
SetDatagridColumnTextBySqlDescribe(DatagridView dview)
Think ...
|
|
|
|
|
Hi all,
Can anyone tell me how do we create minidumps for crashes and hangs in windows applications c#.net 2.0.
I have used ThreadException handler and AppDomain.CurrentDomain.UnhandledException handler to catch exception and log the information.
But what can be done in case of a crash or hang in application.
Can i use ADPlus for this, if so how to implement it??????..........
Thanks,
Pranu.
|
|
|
|
|
If your program crashes you won't be able to use it to dump its own memory now, would you?
Anyway, if you implement exception catching well in your program, it shouldn't crash or hang -specially in a managed environment like .Net where you can't screw up with pointers-, it's unhandled exceptions that makes your program crash, and windows Xp or later provides an automatic memory dump for your application. Most user won't know how to extract the data from the report and send it to you, but if Hex dump is one of your favourite languages you can simulate the scenario and read it as you please -not convenient as you can see-.
pranu_13 wrote: Can i use ADPlus for this, if so how to implement it??????
Read this[^].
Regards
|
|
|
|
|
Hi
I have 2 page 1)Master 2)Pop-Up(window.open). Now i open 2 of this master page. From 1 of them i open this popup which is part of same session and copy the url and past it in other opened master page which has different session. Now if i press Go the the current session is being modified by the popup-ups session.
Why is it so ?? Why session variable become null. I have checked google and taken all possible measure still no luck.
Pls help me.
Thanks in advance.
|
|
|
|
|
Please don't cross post.
---
b { font-weight: normal; }
|
|
|
|
|
Hi all,
How can I open a file (e.g pdf) with its default program (e.g acrobat reader) in C#?
Thx
Ed
|
|
|
|
|
Process.Start(filePath);
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hello
I wrote a multithreading program in vs2003 that don't work in vs2005.
Now I want to write multithreading code with backgroundworker.
But all samples in the web confusing me and i can't understand them!
Please help me to write a simple program to do this :
1-Button 2-TextBox 3-ListBox
By pressing Button, ListBox should fill as equal as TextBox's number.
Button1_Click()
{
for (int i=0;i<convert.toint16(TextBox1.text);i++)
{
ListBox1.items.add("Item #" + i.tostring());
}
}
But i want to do this with BackgroundWorker, So i'll have ability to create second set of this controls on my form to work parallely.
Just give me a simple code for first section.
Tank You
|
|
|
|
|
IMO background worker is quite useless if you already know how to do multithreading yourself. You did it in 2003 you can do it in 2005.
freshonlineMax wrote: don't work in vs2005.
Define "don't work"? What error do you get, and what code do you use?
About your issue if you want to manipulate a control from another thread simple use Control.Invoke() method. ie. Put the above code in a method, and call it from the other thread using Invoke() .
Regards
|
|
|
|
|
Hi,
accessing controls from another thread can result in weird errors. You could use Invoke but I think in this case that doesn't make sense. I suppose this operation takes a while. To shorten this time make sure that ListBox.Sorted is set to false. Second first create a array with all your elements and then use AddRange. That should improve your performance to an extend where threading is hopefully not required anymore.
Robert
|
|
|
|