|
The delay is related ot the ammount of rows which is returned for the database
Mhmoud Rawas
------------
Software Eng.
|
|
|
|
|
I would then suggest looking at the DataReader object instead in this case.
Cheers,
Simon
sig :: "Don't try to be like Jackie. There is only one Jackie.... Study computers instead.", Jackie Chan on career choices.
article :: animation mechanics in SVG blog:: brokenkeyboards
|
|
|
|
|
This is for reading data from the server but what about updateing data to the server you should use the update finction in dataAdapter or you have to write similar function which check the changed data in the dataset to update it and check the deleted data to delete it and check for the new data to add it to the server!!!
Mhmoud Rawas
------------
Software Eng.
|
|
|
|
|
Simon's suggestion is a good one. The DataAdapter actually uses DbCommand s and DataReader s (where applicable) internally. Everything you can do with the DataAdapter can be done with the other two classes I mentioned. Just make a DbCommand for the SELECT (use a DataReader here), INSERT (with option SELECT afterward), UPDATE, and DELETE commands and execute them accordingly, i.e. enumerate the rows, check the DataRow.RowState property, and execute the appropriate DbCommand .
You should get a good decompiler like .NET Reflector[^] and see how the DataAdapter (specifically, a derivitive class like SqlDataAdapter ) works internally.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
|
Marc Clifton wrote:
Is there some benefit to that?
Hmm, not sure about this one, however in all actuality it is best to do the following:
string s = "Nick";
if(s.Length != 0)
MessageBox.Show(s.ToString());
Because the compiler will emit less MSIL in relation to string.Equal(...); . Check this out on the FxCop Rule Topic[^] for System.String.Length .
- Nick Parker My Blog
Last time I checked, all programmers have selective ignorance. I know nothing about 3D graphics. I know a lot about COM. VB gets under people's skin because one can be ignorant of computer architecture and ASM and still get a lot done. - Don Box
|
|
|
|
|
But...
Be careful with .Length because if the string reference is null, you will get an exception.
string s = "Nick";<br />
<br />
if(s != null && s.Length != 0)<br />
MessageBox.Show(s.ToString());
|
|
|
|
|
Correct, specifically a NullReferenceException which is documented in the link I included with my post to Marc.
- Nick Parker My Blog
Last time I checked, all programmers have selective ignorance. I know nothing about 3D graphics. I know a lot about COM. VB gets under people's skin because one can be ignorant of computer architecture and ASM and still get a lot done. - Don Box
|
|
|
|
|
I don't think so. Just checked the IL and apparently
string a = string.Empty;
creates 1 more IL code than
string a = "";
As for any benefits, well, not to my knowledge. Maybe String.Empty is more readable than "" ?
"if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.
Support Bone
It's a weird Life
|
|
|
|
|
Brad Abrams said
"" Actually creates an object.
String.Empty does not.
Thank You
Bo Hunter
|
|
|
|
|
so this means that String.Empty is actually more beneficial?
|
|
|
|
|
Marc Clifton wrote:
Is there some benefit to that?
Marc, FYI, here is the IL between the two (not a whole heck of a lot of difference, huh):
string s = "";
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
.maxstack 1
.locals init (string V_0)
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: ldstr ""
IL_000b: stloc.0
IL_000c: ret
}
string s = string.Empty;
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
.maxstack 1
.locals init (string V_0)
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: ldsfld string [mscorlib]System.String::Empty
IL_000b: stloc.0
IL_000c: ret
}
- Nick Parker My Blog
Last time I checked, all programmers have selective ignorance. I know nothing about 3D graphics. I know a lot about COM. VB gets under people's skin because one can be ignorant of computer architecture and ASM and still get a lot done. - Don Box
|
|
|
|
|
I agree with Bo.
Using String.Empty returns a "const" string object, so you will be refereing to the same object instead of creating another. Performance wise I wouldn't lose sleep over something like this.
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
Marc Clifton wrote:
Is there some benefit to that?
Last tid bit Marc, I was just watching MSDN TV where they talk to the CLR team that created FXCop and they discuss the reason for not using "". You can view this here: Code Correctness with FxCop[^].
- Nick Parker My Blog
|
|
|
|
|
|
Does any one know how to set the color of a scroll bar in XP and make it independent of the XP theme settings?
Lloyd Kreuzer
|
|
|
|
|
Hi,
How do I call WMI to access a remote system's information, such as disk storage and registry keys?
Any pointers will be greatly appreciated.
Thanks.
Sue
|
|
|
|
|
um... "Add Refrence" to the System.Managment dll, then conduct a search of these message boards for an array of various answers. That is as much as I feel safe to answer at this time.
have a nice day.
/\ |_ E X E GG
|
|
|
|
|
I'm such a smart ass. I'm probably wrong though. Actually, I bet I am...
Why do I even post this stuff....
sorry for wasting your time. I bet you got all excited, "YEAH!, somebody knows the answer to the problem I'm been trying to fix for DAYS..."
but no. it's just my incoherent ramblings and missspelled words.
/\ |_ E X E GG
|
|
|
|
|
Sue,
Please check out Windows Management Instrumentation (WMI) Implementation[^]; it should answer your questions.
- Nick Parker My Blog
Last time I checked, all programmers have selective ignorance. I know nothing about 3D graphics. I know a lot about COM. VB gets under people's skin because one can be ignorant of computer architecture and ASM and still get a lot done. - Don Box
|
|
|
|
|
Thanks Nick and Eggie 5 for the info.
Yes, I did find it from using WMI for accessing remote disk information, and I was able to use RegistryKey.OpenRemoteBaseKey() to get the remote system's registry key info.
Sue
|
|
|
|
|
how do the "spyware" programs work that record user behavior outside of their own application? are there standard c# or windows ways to track the mouse, record keystrokes, record which applications are run, or do these programs need to hook low level drivers and such?
anybody know?
Thanks in advance!
|
|
|
|
|
Looking for some help on writing some spyware, huh? I hope to the heavens no one is dumb enough to answer this one!
You might as well ask us to do your homework, too. That goes over real well here, too!
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
newbie1 wrote:
anybody know?
Yes, but to be honest it is best to start with something much simpler than this if you are a newbie. I highly doubt you will get anyone here to post anything explaining how to implement spyware. There are many great articles here on CodeProject that can get you started in C#. Why not register for an account and start reading them, then you can also download the source code too.
- Nick Parker My Blog
Last time I checked, all programmers have selective ignorance. I know nothing about 3D graphics. I know a lot about COM. VB gets under people's skin because one can be ignorant of computer architecture and ASM and still get a lot done. - Don Box
|
|
|
|
|
Nick, thank you. i have in fact looked at some of the great many articles and i agree CodeProject is a wonderful place, i've also purchased from people that advertise on CodeProject.
As for how spyware is implemented, I think the question of how things like this are implemented is a perfectly reasonable question, and of general interest to the community. if the answer is that it can't be done by documented api's or in a "legitimate" way, that would be an interesting discussion.
apparently i asked a taboo question, but why? if you don't agree that it's a question of general interest to this forum, please say so, but please! if you think you're keeping the world safe from spyware by not discussing it on CodeProject-- number one i am NOT implementing spyware, number two the people who are implementing it certainly seem to be doing it just fine without help from this forum.
my $.02. and no offense to you or to Heath-- i know you guys take a lot of time and put a lot of thought into these posts, and you are certainly well respected and appreciated (*even if* in this particular instance i think you're off the mark).
Thanks!
|
|
|
|