LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

WHERE clause doesn't work in certain column

Hi All,

 

I try to filter mysql database using WHERE clause...everything seem working until i found there are 3 column that i can't use for WHERE clause query. When i use that columns to filter, there's no data appear in the table but the other column is working. Attached is my VI and mysql database. I really don't know what cause it happen. Any help would be very appreciated

 

Thank you

Download All
0 Kudos
Message 1 of 12
(5,162 Views)

Your WHERE clause doesn't make any sense. Are there supposed to be other values in your combobox? What is "WHERE WIWI" supposed to even mean?

 

Also, that Negate function is incorrect. The Value Change event will be fired when you press on the button. By definition the value of the Boolean will be true. You do not need to wire anything to the tunnel for that event case. You should have a second "Stop" button on the front panel. In the Value Change event for that button you should place the Stop terminal inside the event case and connect it to the tunnel. Simply leave the tunnel set to "Use default if unwired".

0 Kudos
Message 2 of 12
(5,142 Views)

this is my first exercise VI and also i'm new to programming thats why i need to ask many things in this forum. so how can i make my VI work with WHERE clause? i need more than one value in the combobox.

0 Kudos
Message 3 of 12
(5,137 Views)

Have you tried the select from whatever SQL command interpreter that MySQL provides?

 

It needs to be in the form SELECT * FROM issue WHERE 'condition'. If you want to get all the rows where person 1 is Harry then you would write

 

SELECT * FROM issue WHERE person1 = 'Harry'

 

The way your VI is written you will get one of two commands.

 

SELECT * FROM issue WHERE 'All' or SELECT * FROM issue WHERE 'WIWI'

 

That may return all rows if a string resolves to true. I don't use MySQL so I wouldn't know.

 

Disregarding LabVIEW for a moment, what is the SQL command or commands that you want your VI to send to the ADO execute VI? That might help figure out what it is you want to do.

 

=====================
LabVIEW 2012


0 Kudos
Message 4 of 12
(5,114 Views)

actually i want to filter the retrieved table using a dropdown/combo box. i.e i wanto to filter the data based on person1 column "SELECT * FROM issue WHERE person1='hary'; what i want is when the query execute, the table will only display a row contain 'hary' in person1 column. i use concatenate string to merge the string. the combo box will have 15 values to filter the table. the problem is why when i sue person1, person2 and person3, the WHERE clause query is not working. i've try the other column and its working.

0 Kudos
Message 5 of 12
(5,109 Views)

What is the "other column" that is working?

 

Try something like this. You can specify the column and the person name in two combo boxes.

 

 Example_VI_BD.png

=====================
LabVIEW 2012


0 Kudos
Message 6 of 12
(5,105 Views)

As a side note, if you use the Format Into String function, be very careful that the input strings have been properly sanitized or come from a trusted source.  You don't want a curious, malicious, or simply fat-fingered user executing arbitrary SQL statments.

 

Obligitory XKCD comic: Little Bobby Tables.

Message 7 of 12
(5,093 Views)
Absolutely! I don't have LabSQL but maybe it supports parameterized queries. I know that the database connectivity toolkit does.
=====================
LabVIEW 2012


0 Kudos
Message 8 of 12
(5,083 Views)

thank for all the advice...but i'm still get the same result after using format into string. its intermittent working on remarks1-3 column and still blank on person1-3 column.

0 Kudos
Message 9 of 12
(5,061 Views)

can someone give me an example how to filter mysql result using combo box please?

0 Kudos
Message 10 of 12
(5,058 Views)