LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SQL SELECT Statement Problem

I have been using ADO vi's to connect to a datbase using an SQL SELECT statement and returing records.
Thats all working fine.

I have now changed my SQL SELECT statement to have a LIKE statement in it.

SELECT DHR.ProductCode, Count(DHR.SerialNumber) AS CountOfSerialNumber1
FROM DHR
WHERE (((DHR.TestDate)>=#8/1/2003# And (DHR.TestDate)<=#8/30/2003#) AND ((DHR.LastTest) Not Like "End"))
GROUP BY DHR.ProductCode
HAVING (((DHR.ProductCode) Like "351003"));


The SQL works fine in ACCESS but LABview 6.1 does not like it at all it just returns and error.

i.e. Error Code -2147217904
Exception occured in Microsoft OLE DB Provider for ODBC Drivers, [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2.. i
n ADO Connection Execute.vi->SQL Execute.vi->select.vi

I do have LABview 7 dont know if that will help matters?
Have I got to a limitation of ADO vi's?
Should I try using the Database tools instead of the ADO vi's?

Any help or examples would be greatfully appreciated.

ADam
0 Kudos
Message 1 of 4
(3,607 Views)
I'm not sure if I'm right.

But try to replace the " with '. What Labview sends to database engine is wrapped in "", so inside the statement, you might need to use ''. That's why ODBC return an error message "too few parameters".

Tell me if it solves the problem.
0 Kudos
Message 2 of 4
(3,607 Views)
Yes you are excellent thankyou.
Now all sorted.


Stupid me its the same with php files accessing databases through SQL.

Adam
0 Kudos
Message 3 of 4
(3,607 Views)
Hi Learner:

I'm interested to know how you're interfaced PHP with Labview. I have a few tricks of my own...I think PHP is an excellent combination with Labview, especially for automatically posting data.

Eric
Eric P. Nichols
P.O. Box 56235
North Pole, AK 99705
0 Kudos
Message 4 of 4
(3,607 Views)