07-22-2008 09:47 AM
My code appears in ADONET.png. (I have left out some of the garbage collection stuff - cleanup). When this code runs, it takes about 14-sec to compile the string array. When I execute similar code using the Database Toolkit, it takes about 2 seconds, and with LabSQL, it takes less than a second.
I would like to continue to work with .NET in LabVIEW, but is seems that the interop between LV and .NET is clunky and slow. The lack of automatic garbage collection and ramifications (memory leaks and orphaned references) are not always obvious, and the interface between data types and casting issues seems to be problematic as well. Unfortunately, I believe that ADO will eventually go away and Microsoft will continue to support .NET rather than ADO.
Any opinions / observations / comments on code? Your professional insite would be much appreciated!
Thanks, -cb
07-22-2008 10:05 AM
07-22-2008 11:10 AM
07-22-2008 12:17 PM
Thanks for the advice. I think I was starting to lean toward LabSQL - seems like a nice interface to ADO and open-source as well. I am curious about the speed issue in .NET and wonder if I am using it wrong. That will be another spike some other time.
Thanks, -cb
07-22-2008 12:54 PM
06-26-2015 06:37 PM
I see that this thread is very old, but I wanted to toss this out there,,,
ADO.net in labview is very fast and efficient.
Looking at your code I see that you are only using the 'connection' and 'dataAdapter' within the ado.net framework.
Technically I don't think you are even using ADO.net in your code.
Instead you are using the data adapter that ADO.net would use in it's framework.
You are iterating reads via a data adapter command.
This is a very bad idea, and will produce horrible results.
The real power behind ado.net is the usage of the ADO Dataset and ADO Datatables.
What you should do is create an ADO dataset and then execute that command with a fill operation to a local dataset.
From that local dataset you then perform your data reader operation.
In your code i'm not really sure what the SQlDataReader would do,,,
I think it will query the SQL server, but the results will not be stored on your machine.
So, as you iterate through each line of the reader it will send a request back to the SQL server for the next line in the data stream.
ADO.net has many cool background buffering services that just works without you really paying attention to the details.
For example you can create an ADO table reader and then execute a table command.
From my experiences ADO has the data ready faster than what LabVIEW can process it.