LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read the data using the saved Queries in MS Access

Hi All,

      There is a MS Access database which has the defined queries .The defined queries has been linked with many linked many tables globally and has left joints with few tables as well.

Now I need to read the data using only the name of the saved queries ? 

 

Things I have tried :

 I was using Microsoft.jet OLEDB database provider in my program.

1.I have tried with the direct queries i.e. I just copied the query from MS Access database. View -> SQL View -> Query. I mean with out using the query names. I do get what I expected.

2.I passed the query with the parameters . I do not get any data nor the error.

Ex: Saved Query name : TestQuery. 

SELECT * FROM (TestQuery) WHERE [table1.Name] = "xxx";

 

 

I want to use only the saved query names with the selection parameters. Because the user might change the parameters frequently and save the query in the database. Query name is the unique one here.Is there a way to read the data using the query names from labVIEW? And I don't have the access to modify the global table also. All I can do is read the data using the saved queries.

 

PS : I am not supposed to display the Design View and Query Design of the database as per my organization policies.

0 Kudos
Message 1 of 4
(3,867 Views)

The "TestQuery" you mentioned refers to table name or the query itself, because the sql statement should be something like --select *from("expected table name"). If your "TestQuery" is an sql statement(or query) you can use string functions in labview to alter query get data from database.

bp
0 Kudos
Message 2 of 4
(3,848 Views)

I think you will find the answer here:

http://www.mooregoodideas.com/calling-access-queries-that-contain-parameters-from-the-labview-databa...

Access is a bit weird sometimes.

Ian
LabVIEW since 2012
Message 3 of 4
(3,830 Views)

TestQuery is the Query that has been saved in the database. That's not the Table name. As I have said this saved query has to fetch the data from many tables. 

 

 

0 Kudos
Message 4 of 4
(3,826 Views)