07-21-2011 09:24 AM
Hi everyone,
I am using LabVIEW 8.2.1 and the LabVIEW Database Connectivity Toolset to perform a query and get the result set. I am able to obtain the data but not the column names from the specified query.
I want to return these queries in MS Excel reports and having the column names would be helpful without me having to create the headings myself. Any ideas would be greatly appreciated.
Solved! Go to Solution.
07-21-2011 10:06 AM
Use list columns under utilities then build array like this
07-21-2011 10:24 AM
Wouldn't that be for a specific table in my database? My query consists of joining multiple tables and only selecting certain column headings.
Example:
SELECT M.SerialNumber, M.Date, G.Frequency FROM main M JOIN gain G ON G.Test_ID=M.Test_ID Where M.Station_ID = '37' AND G.Direction = 'Tx'
07-21-2011 10:45 AM
07-21-2011 10:59 AM
@cschruder wrote:
Wouldn't that be for a specific table in my database? My query consists of joining multiple tables and only selecting certain column headings.
Example:
SELECT M.SerialNumber, M.Date, G.Frequency FROM main M JOIN gain G ON G.Test_ID=M.Test_ID Where M.Station_ID = '37' AND G.Direction = 'Tx'
I'm confused. Your column names are in your SELECT statement.
07-21-2011 11:14 AM
Yes, they are but when I perform the query and get the recordset, only the data is stored. I would like to have the column headings as well without having to create an array with the headings manually for each of my queries.
07-21-2011 11:30 AM - edited 07-21-2011 11:37 AM
The only way I can think of doing this (right now) is using two of the list column info VIs.
Edit:
If you use a parameterized query you can use the column info used to create that in your spreadsheet.
07-21-2011 12:11 PM
Or write a VI to parse a select statement.
07-21-2011 12:13 PM
Thanks Dennis and Steve. I thought there would be an easier way to do it but I guess parsing will have to do.
07-21-2011 12:26 PM
There is an easier way. Here is the snippet, VI also attached in 8.2 format. I see you marked the solution but it is possible to change.