|
You can keep the data in a generic List which can be enumerated later for checking. Assume you are getting numbers from data reader.
List<int> data = new List<int>();
using(SqlDataReader reader = getTheReader()){
if(reader.HasRows)
{
int ordinal = reader.GetOrdinal("YourColumnName");
while(reader.Read())
data.Add(reader.GetInt32());
}
reader.Close();
}
|
|
|
|
|
prasadbuddhika wrote: what i need is to read previous data to compare data with previous data.
So, you want the previous data to... eh... use it? Could you be a bit less specific, please?
If you for example need the previous data in order to only display one of each value, that could be done before you get the data from the database. I.e. instead of:
select Name from SomeTable order by Name
and
if (Name <> PreviousName) ListBox.Items.Add(Name);
you could do:
select distinct Name from SomeTable order by Name
and
ListBox.Items.Add(Name);
This way you would only fetch the data that you actually use from the database, instead of fetching a lot of data only to throw it away. In similar ways you can use the database to group records and calculate things like sum, average, minimum and maximum.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
i used the transactionscope to control the transaction for accessing two tables in two databases, but when i run the application it says "MSDTC is not installed or configured "
any solution ..
|
|
|
|
|
I would suspect the answer lies in the message it gives - "MSDTC is not installed or configured" is pretty clear to me.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
hi,
i have a list view control, which is binded with some data from database ,i tried to sort the list view column header,using Icomparer Class ,if the items are added through items collection it is working without error, but if the items are binded from database the Icomparer class is not working properly.Please any one solve my problem and thanks in advance.
|
|
|
|
|
Hi All,
I am using device with WINCE and my application is in .NET compact framework in C#.I want to operate my device from my desktop pc, so for that i used CERDISP2.exe(on device) and CeRHost.exe (on desktop pc)it works fine but if i keep CerHost.exe idle for longer duration (e.g. 4 hrs)i get the error "Error from recv of screen". The screen goes blank after this and to re-establish the connection i need to restart both the utilities again.
Can anybody tell what is the meaning of this error? and possible solution?
Thanks,
Tushar
|
|
|
|
|
Hi,
how to show a progress bar without cross-thread error ?
can we invoke delegate of a function which include a number of controls like Textbox, progress bar....?
Is there a way we can turn off detecting cross-thread error? Should we do that?
Thanks!
|
|
|
|
|
trang1800 wrote: how to show a progress bar without cross-thread error ?
Use Control.Invoke/BeginInvoke to safely update your controls from another thread. See the sample below
if (this.InvokeRequired) {
this.BeginInvoke((MethodInvoker)delegate {
});
} InvokeRequired returns true if it is called from another thread which is not the owner of the control. MethodInvoker is a delegate provided in System.Windows.Forms namespace and can be used to represent parameterless methods. You can have your own delegate if you have parameters to be passed to the function which updates controls.
Alternatively, use BackgroundWorker helper class. It makes the control updation easy.
|
|
|
|
|
Thank a lot!
The 1st method works.
How to use use BackgroundWorker helper class ?
Thanks
|
|
|
|
|
I have written and article[^] about it. Hope it helps
|
|
|
|
|
trang1800 wrote: Is there a way we can turn off detecting cross-thread error?
Yes.
Control.CheckForIllegalCrossThreadCalls = false;
trang1800 wrote: Should we do that?
No.
Keyboard not found. Press F1 to continue.
|
|
|
|
|
blackjack2150 wrote: Yes.
Control.CheckForIllegalCrossThreadCalls = false;
Yes, but only when the debugger is attached.
|
|
|
|
|
Hi. I have a SSL server and a SSL client that communicate with each other, both written in C#. Now I would like to write a SSL java client that's able to communicate with the server. I found few code examples, but none that explains where to specify the certificate. Maybe someone can help me out.
Thanks.
|
|
|
|
|
So this is a Java question, then?
|
|
|
|
|
blackjack2150 wrote: So this is a Java question, then?
Yes and no since I want both sides (C# server and Java client) to communicate with each other.
|
|
|
|
|
Anyone know how to do multiline indent/outdent? Like in Visual Studio...select multiple lines, press Tab, and it indents the selected lines. I'm doing this in a RichTextBox. Thanks.
I've searched both Google and this site but have found nothing. (By indent, I don't mean the indent property, I mean adding a tab in front of every line)
Thanks.
|
|
|
|
|
Indent:
richTextBox1.SelectionIndent += 10;
Outdent:
richTextBox1.SelectionIndent -= 10;
When you're alone in the Dark, Fear will protect you...
|
|
|
|
|
As in...by tabs...('\t') character. I figured out the indent part actually...I just need the outdent.
|
|
|
|
|
Didn't SelectionIndent work?
I wonder how you programmed Multiline Indent action by inserting '\t' characters!! By a loop?
When you're alone in the Dark, Fear will protect you...
|
|
|
|
|
SelectionIndent adds a real indent to the box. I want to take away the tab character at the front of each line if it exists. I think I may have just figured out how. And yes, I used a loop to add in the '\t' characters.
|
|
|
|
|
Well, I think you have some choices to do that but of course they're not too common!
For example:
"\t\t\tHi".TrimStart(new char[]{ '\t' });
Removes all '\t' chars from the beginning.
You can also use String.Split or maybe String.Substring or ... However, whatever you use, I think, you haven't a simple and clean solution. I still prefer SelectionIndent
I died as a mineral and became a plant,
I died as plant and rose to animal,
I died as animal and I was Man.
Why should I fear? When was I less by dying?
-- Rumi[^]
|
|
|
|
|
Hello Everyone,
I am creating a small application that looks like an Excel Spreadsheet for scheduling purposes. It looks as such:
Employee Name 1 | Employee Name 2
11/01 8:00-10:00 Blah | 8:00-10:00 blah blah
11/02
11/03
What I am trying to do is allow each cell to have multiple selectable lines in it. For instance:
Employee Name 1 | Employee Name 2
11/01 8:00-10:00 Blah | 8:00-10:00 blah blah
12:00-1:00 Lunch |
11/02
11/03
I have seen other applications that are able to do this without creating another row and duplicating the date. I have read and read but I can't seem to find anything that points me in the proper direction, most likely due to the fact that I don't know what keywords to look up in order to find what I am looking to do. Any pointers in the right direction of how to achieve this would be greatly appreciated!
|
|
|
|
|
Hallo
i'm writing the GUI for some console applications and i want to include those apps directly in the GUI executable.
In particular, i'm writing a brief program to launch (in sequence) DISKPART and imagex to restore an os onto a specified partition.
could you point me to any resource about?
thanks in advance
R
|
|
|
|
|
You can add the console application as an embedded resource, extract it at runtime and use Process class to start it. Here is a similar example: Bat file compiler[^]
|
|
|
|
|
Hey guys,
I'm calling the Process.Start() methode on an application that once started, it fires up a new application and exits so as you can see, another process is actually started by the originally lanched process which I cant monitor when it exits "the newly lanched application", you may like to call this "handing over".. Any idea how can we catch the later application and monitor when it exits??
Thanks guys!
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|