|
Thanks to you all for your anwsers and for taking the time to help me with my problem, which is now solved.
Thanks again
Matjaž
Força Barça!
|
|
|
|
|
i want to get network systems hardware information whit a c# application!
i have IP and administration username and passwod.i want install this application on server.
please help me !
ali.moharrami@gmail.com
|
|
|
|
|
Hi Ali,
Welcome to CP
moharrami wrote: i want to get network systems hardware information whit a c# application!
[Edit]
A simple Google search could help you faster.
[\Edit]
There's a great article in CP, titled "How To: (Almost) Everything In WMI via C#", by thund3rstruck. I think the 3rd part[^] can help you.
Good Luck
When you're alone in the Dark, Fear will protect you...
|
|
|
|
|
how to read the prevoius row using a sqldatareader(rs) object(opposite of rs.next())
|
|
|
|
|
You can't move backwards in the data stream. Once you move forward, the previous record doesn't exist any more.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
thanx. then how can i get the previous record , what is the option i can use ..
|
|
|
|
|
Don't use sqldatareader. Use dataset instead.
Apurva Kaushal
|
|
|
|
|
Well, you can't actually use a DataSet instead of a DataReader, as you need a DataReader to populate the DataSet with data from the database.
Also, if the DataReader reads from a large result, it might not be practically possible to put all the data in a DataSet.
Back to prasadbuddhika about what it is that he actually is trying to do...
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
You need to save the current record, then when you read next the record the one you have saved is the prevous record. Obvious really!
Bob
Ashfield Consultants Ltd
|
|
|
|
|
That's true if you only need to back up one record. Suppose you want to back up two....
The previous answer is, I think, more what the questioner needed.
If you want to move forward AND backward, you need to use a DataTable, not a DataReader.
|
|
|
|
|
David Fleming wrote: That's true if you only need to back up one record.
Which is what he asked
The possibilities are endless - datatables, collections, arrays. It all depends on what he wants to do - and as usual there was no clue to that.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Instead of asking about what you think is the solution, I think that you should rather ask about what you are trying to accomplish.
Why would you need the previous record? If you are trying to compare some data, perhaps that would be much faster in the database query than in the C# code?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
what i need is to read previous data to compare data with previous data.
|
|
|
|
|
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.
|
|
|
|