From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
04-29-2011 10:06 AM
Before doing your select statement, have you selected the database to use ?
Try to make a small vi that demonstrate what you are doing and post it here.
04-29-2011 12:08 PM - edited 04-29-2011 12:13 PM
Edit: I didn't see your other post so the semicolon is probably not the problem. What does the server error log say?
05-01-2011 08:09 AM
select top 1 id from SensoresIR1 order by id desc
/Y
05-01-2011 09:34 AM
Just going back to your original post where your SQL statement didn't work the reason is as follows...
SELECT id FROM SensoresIR1 WHERE id=36151 = ERROR!
SELECT id FROM SensoresIR1 WHERE id='36151' = GOOD
ie. you just need to put apostrophes around the value that you want to search for - this syntax will work of MySQL and MS SQL databases.
Chris
05-01-2011 10:44 AM
@Chris Reed wrote:
ie. you just need to put apostrophes around the value that you want to search for - this syntax will work of MySQL and MS SQL databases.
Chris
nomade42k, I would be interested to hear from you if that worked. You do not have to quote numeric datatypes although you can. I can not speak to MySQL or MS SQL as I only use PostgreSQL. I know that MySQL has some funky syntax. Is id a string? That would totally explain the error
The reason I did not think it was a string is because you said it is automatically assigned by the server which implies it is an integer sequence.
05-02-2011 10:05 AM
Hello!
here I leave you my block VI and the DB with its columns (in spanish)
It still doesn´t work...
05-02-2011 10:44 AM
I think you need to quote your time string. I don't know if MySQL uses single or double quotes.
05-02-2011 10:56 AM
After looking at this some more I notice you are using the select vi. You are sending the entire SQL statement to the where clause input. There is a vi under advanced called 'execute query' which you will want to use when you are building the statement yourself. The select just requires the table input and an array of columns.
Try something like this. You may need to change the quote from single to double (or remove the quote if the DB tools is smart enough to quote the parameters. I have never used it)
02-22-2015 08:40 PM
Err message disapears after add 'where' in my case 😉
02-23-2015 02:17 AM
@Onin wrote:
Err message disapears after add 'where' in my case 😉
If memory serves, the Select function adds Where automatically (if the string is not empty), so you'll get a double Where in this case.
/Y