|
Hi Experts
i Have Data of 2 millions of record i am using C#.NET and SQL Server 2005
then suggest me what i am using either sqldatareader or SQLdataadapter
which is faster.
Thank u
Dinesh
|
|
|
|
|
Rather than us telling you, you should attempt to find this out for yourself. While I think that the DataReader will be faster, you don't know why this is my opinion. You don't know that it's because the DataReader is a firehose cursor, and you can't tell whether I'm right or absolutely full of it.
By attempting to solve this yourself, you will develop your critical thinking and analytical skills which will make you better able to evaluate whether or not you are being given valid advice. This, in turn, will help you grow as a developer. Alternatively, you could stay a cut and paste monkey for the rest of your life, and just get others to spoonfeed you information. The choice is yours.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Before discussing the comparision, may I ask you something. What are you gonna do with 2 Million record at the application level?
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Manas Bhardwaj wrote: Before discussing the comparision, may I ask you something. What are you gonna do with 2 Million record at the application level?
Second that. Anyway, you may have a good reason for this so...I assume that DataReader will be faster, but I don't really have DB with 2 Million records to verify that
|
|
|
|
|
Obviously the First thing you should remember
1) retrieve the Fields that your Application will need
2) Retrieve the number of records by using where Clause
3) Use Dataset or Datatable if you are going to Update the Data else Datareader.
but please Be specific, what are you going to do with the Data? You cant Display 1000 000 in gridiew that will be a bad idead and Design.
Hope it Helps
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
1. Pulling out 2 million records at once means your application needs redesign.
2. If there is an unavoidable reason to do this, then choose depending on what you will do with those records.
For instance, if you are going to write them to some other place, use datareader.
Your post reminded me of an aticle I had read some time back. Here[^] it is, if it helps.
|
|
|
|
|
Here's a hint: the DataAdapter uses a DataReader to do all the work (same with ExecuteScalar and ExecuteQuery).
|
|
|
|
|
Hi Guys,
My .net 3.5 solution contains a wpf application and a class library project (dll).
The dll is referenced (add reference --> projects tab) by the wpf app.
I added a web reference to the class library and configured its "URL Behavior" to dynamic,
so that when I deploy the application I could replace the WS's url in the app setting.
An app.config file was automatically generated in the class library project, containing the settings for the project:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="MyDll.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<system.serviceModel>
<bindings />
<client />
</system.serviceModel>
<applicationSettings>
<MyDll.Properties.Settings>
<setting name="MyDll_MyServices_DataService"
serializeAs="String">
<value>http:
</setting>
</MyDll.Properties.Settings>
</applicationSettings>
</configuration>
When I build the solution, only the wpf.exe.config file is created - the dll.config
file is not copied to the output directory.
I thought maybe the settings were merged but the wpf.exe.config file doesn't contain
the above settings from the class library app.config.
Bottom line - If the dll config file is not copied / merged to the exe config, I can't change the url of the WS!
The code in the class library will always use the default values since it won't find it in and application setting.
I know I can manually copy the dll's settings section from its app.config file
to the WPF's app.config file, but this sounds like a bad idea.
What is the right way to complete my goal?
Thanks,
Shaul
|
|
|
|
|
One way to do this (and the only way you can associate a config file with a DLL) is to load it into a separate App Domain. I explain how to do it here[^].
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
First of all - Thanks for the answer.
I've read your blog post and your solution, however I prefer that my host (wpf exe) would not be responsible of delivering the config file to the dll.
Your solution works very good for the Plugin scenario, but in order to implement it I would have to copy the dll's config file to the exe's bin directory and use it's path in the exe's code.
I don't see much difference between this and manually adding the relevant setting to the exe config file.
Isn't there a better way to do this?
|
|
|
|
|
shaul-y wrote: Isn't there a better way to do this?
No. That's the whole point of the post. DLLs can only use config files with trickery (as described in the blog). You've effectively got two choices - add the references to your exe's config file, or use the technique I described and deploy the DLL and DLL config file. That's it. How else do you think you could do this?
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
I'm not saying there's a better way, otherwise I wouldn't be asking this question
Ideally I would have expected Microsoft to support separate config files for class library.
Since a dll is always hosted by an executible who's config file overrides all other config files,
there's no point in having a feature like app settings of a class library object that in fact will never be used...
|
|
|
|
|
Hi All,
I want to hide the default icon provided by the form. If I set ShowIcon property of the form to false, then there is no icon displayed in the form even though the user gives the icon at the run time.
is there anyway to know whether the default icon or user specified icon showing currently in the form?
Thanks is advance.
|
|
|
|
|
I think the default icon is also just a normal icon from visual studio.
If you want to hide an icon, set ShowIcon = true, and use a transparent icon.
Then if the user want to set a new icon, just replace the Icon property.
|
|
|
|
|
thanks stancrm. Your idea works fine
|
|
|
|
|
Hi All,
I'm looking for a way to control a winforms application from a remote computer. The situation is as follows:
I wrote a "headoffice" application, and there are 30 shops that use a client application. The headoffice has to be able to "take over" the client application (or computer, even better) from each shop.
I suggested using remote desktop or VNC, but the solution has to be foolproof, with no windows vista firewall questions for the user.
So is there a way to let my client application send screen information to the headoffice application, and accept mouse and keyboard events from the headoffice without having to install additional software? I already tested vncsharp, but without succes because it only supports being a VNC client.
All computers are linked up through a VPN and can "see" each other.
Thanks in advance for suggestions!
Jan
|
|
|
|
|
Member 4323018 wrote: I suggested using remote desktop or VNC
remote desktop is the best solution here, 100%
Member 4323018 wrote: but the solution has to be foolproof, with no windows vista firewall questions for the user.
You're screwed. You can't stop the firewall asking questions without turning it off, or configuring it to not ask, which is probably easier to do with remote desktop than a third party app.
Member 4323018 wrote: So is there a way to let my client application send screen information to the headoffice application, and accept mouse and keyboard events from the headoffice without having to install additional software? I already tested vncsharp, but without succes because it only supports being a VNC client.
I would suggest using GoToMeeting, or Remote desktop. I'd say that trying to write those apps again, just to control one app, is totally insane and a waste of time.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
If I was you I would consider a simple application of my own. Create a Client/Server setup.
The client Prints the screen and sends the info, the server sends mouse and keyboard data for the client to process on the computer.
This is just a simple idea as to how you could achieve something like what you need, but you will want to look at more optimised techniques as print screen and send will most likely be very slow.
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Good day
I am using unsafe code to do image processing from my webcam. A clever way of doing image manipulation is using a colormatrix (eg. greyscale conversion). Its performance is very good, but I am now moving on to the task of video recognition...
Is it a good idea to use the "colormatrix" to do recogntion, and if so, how do I access individual pixels and RGB content while keeping performance optimal?
Or should I stick with unsafe code without a colormatrix (ie. just access each pixel manually)?
|
|
|
|
|
If you can use a color matrix to recognise the content of a video, then you're plainly a genius. You should write an article about that.
( a color matrix is basically a per pixel filter, there's no way you can do any sort of recognition with it, not least because it doesn't return anything except a modified image )
You can read my articles on image processing to see how to access the pixels directly.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Sorry, I didn't quite understand how colormatrix works. Thought it might help since it seems to convert images to greyscale faster than manually iterating through pixels.
Using some of your articles and they've helped a lot thanks.
|
|
|
|
|
It does convert to grayscale but that is not going to tell you what an image contains. I assume you are trying to get to the point where you either have back or white pixels (two-tone).
This method is naturally a first instinct for image processing as you can hope to get a 'shape' from this data. But it's not so simple, where do you draw the line for the contrast? you cant use a fixes value because the image will change depending on the lighting.
How is it you intend to detect the shapes of the hands in the image? (assuming you are still attempting the sign language application)
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Yes, you are probably right, a binary image will most likely be my next step. One idea that comes to mind for this is to normalize the image tones and then using a range corresponding to skin tone to extract the hand.
Although I doubt this will be the best method as I'm sure there are better ones out there.
With regards to shapes, "cascade classifiers" is something I am going to have a look at and see if it works. I know it works for face recognition, but will have to see if I can get results on the sign language.
|
|
|
|
|
Well you sure have a big challenge on your hands...
I take it you have seen the bitmap functions for GetPixel() and SetPixel()? This is slow and as you have mentioned using unsafe code - this should be faster. I don't think I have seen any example of another method to obtain/assign pixel data from an image.
One thing that does come to mind (Not tested so can't say it will be good idea) is to just create a 2D array of pixel data from the image and use that data. I don't see you will ever need to set the pixel data back to the image at any point so maybe this is something worth looking into (performance wise)
All the best with your task anyway
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Thanks
I did actually think of that, so it's good to know I'm not the only one that thinks it might work
At the moment I'm getting 30FPS using the unsafe code, so hopefully won't have to resort to that, but will let you know if I end up trying it.
|
|
|
|