LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

query using database connectivity tool kit

I'm currently using an application that can read and write from an access database using labview. My problem is that I want to somehow have a query (hopefully just using the tool kit) that searches the database and displays the results in the read screen. I uploaded the program... can someone please take a look at it and try to help me out. I know the "look up screen" is a little messy, but i'd greatly appreciate any help you can give me.
Thanks
0 Kudos
Message 1 of 11
(4,021 Views)
I am unable to look at your program, since I am using an older version, but here is an example of what I do to display query results. I just do an SQL query and display it in a table. All data must be converted to strings first, though.
0 Kudos
Message 2 of 11
(4,021 Views)
Thanks for the example! I have an idea on how it works now... but i have a quick question. Is the field marked 'FWO' used to search all fields of the database or just the first column?
thanks again.
0 Kudos
Message 3 of 11
(4,021 Views)
FWO is the name of a field. It doesn't search based on column position, but on column name. SQL doesn't like spaces or some other characters within the names. You may want to make sure your database follows this. Access doesn't care, and queries within Access don't care, but SQL does.
0 Kudos
Message 4 of 11
(4,021 Views)
i'm still haveing trouble w/ the sql query. I used SELECT* FROM inserttable WHERE search='... its in the same format as yours. i keep getting an error (-2147...) once it leaves the "quesy EXE DB icon".
0 Kudos
Message 5 of 11
(4,021 Views)
I'm not sure of that exact error, but the way the search parameter(=?) is inserted is important. If the field in your database is text, then the parameter must be in single quotations(WHERE search='Joe'). If the field is a number, just use the number(WHERE search=123).
0 Kudos
Message 6 of 11
(4,021 Views)
Is "search" an actual column name in your database? It has to be, otherwise you'll get an error. The correct syntax for a SQL query would be somthing like:

SELECT * FROM TestTable where DateTested = '08/26/03'

where TestTable is the table name and DateTested is a valid column in the table.

Also, you should always list the entire error code and not some abbreviation like "-2147...". Secondly, there are numerous SQL tutorials on the net and in printed form. You might want to do a web search.
Message 7 of 11
(4,021 Views)
A huge THANKS to both you and Brian. My application is up and running perfectly. My final question: Is there any way of being able to search or "query" all columns at the same time instead of just searching through one? or is SQL limited in this?

THANKS AGAIN!
0 Kudos
Message 8 of 11
(4,021 Views)
You can do it with one query, but you have to list all columns. Ex.: SELECT col1, col2, col3, etc FROM table WHERE.....
0 Kudos
Message 9 of 11
(4,021 Views)
It returns the same thing... i used:
SELECT * From newtable where Project='rig'
it returns all rows (which is exactly what i want, but it will search for "rig" only in the project column. I want to be able to have it search the PROJECT and PART columns at the same time.
0 Kudos
Message 10 of 11
(4,021 Views)