LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get the enumerator from a dataset/datatable/column

I have created a Web service in VB.NET. This service returns a dataset. To call it from within Labview i created a .NET assembly that actualy calls the web service.
 
So far i can get the name o f the returned table (the table that the .net assembly returns after it calls my web service), but i can't iterate through it's datarows and columns.
 
For example, i can get the number of the columns that a datarow has, but i don't know how to get the column names for this datarow, because i can't get the enumerator for the columns collection. The GetEnumerator has no properties or methods for iterating.
 
Anybody has any ideas or have tried something similar?
0 Kudos
Message 1 of 5
(4,320 Views)

It might help if we had some more information. For instance, what are you actually "passing" into LabVIEW? Is it an array? Is your question about how you can get a certain set of data that already exists in VB into LabVIEW or is it about particular functions within VB? If you question is about actual VB coding, it might be more useful to try posting it in the Measurement Studio VB forum where it will have exposure to people most familiar with VB.

Kind Regards,

E. Sulzer
Applications Engineer
National Instruments
0 Kudos
Message 2 of 5
(4,295 Views)
Let me make things straight. I have a SQL Server with a huge database and i have 50 clients that periodically must search for a specific record.My network is very large, with 8 class C subnets. So to avoid traffic i created a web service that runs on that SQL Server (with IIS installed of course), searches for that record, produces no traffic because it runs on the same machine as the SQL server, and returns a DATASET. This dataset contains ONLY one table, and that table contains ONLY one row with the data. This web service is generic. Some of my clients use applications written in VB.NET, others use applications written in C#, and one of the rest must use LabVIEW to connect to that service. As far as i know, Labview can't connect to a Web Service straight. So i created a wrapper .NET assembly that calls this web service. This assembly returns the same data type, a DATASET. I managed to call this assembly from within Labview, i managed to count the tables that the dataset has (just one table, in my case), as well as the number of the columns that table has (59 in my case). So now, i would like to iterate through the columns collection and get the column names. And here's my problem. I can get the  GetEnumerator class which should help me iterate through every column in the columns-collection, but this class does not give me methods such as MoveNext, MoveLast etc etc.... I believe my problem is not of VB code type. But maybe i should create my wrapper assembly differently. If somebody could give me some directions on that.
0 Kudos
Message 3 of 5
(4,292 Views)

I may have made some headway in getting the GetEnumerator class working. Go to Tools>>Advanced>>.NET Assembly References and you'll need to add the MSCORLIB assembly. It should be located in the path WINDOWS\Microsoft.NET\Framework\v1.1.4322, although my version may be different from yours. Once the assembly is added, click OK and restart LabVIEW. Doing this appears to give you access to the Enumerator methods for a Data Column Collection.

Best of luck!

E. Sulzer
Applications Engineer
National Instruments
0 Kudos
Message 4 of 5
(4,279 Views)
YES THAT'S IT!!!! 
 
I could not believe that adding mscorlib.dll was really the solution. I was thinking that my problem was the way i wrote the wrapper .net assmbly.
 
 
Thank you very much! I appreciate!
 
 
Nick Stamou
Elval S.A.
 
Athens,  Greece
0 Kudos
Message 5 of 5
(4,274 Views)