12-15-2020 03:16 AM
Hey,
i try to select values from my database.
My problem is, i do not get all values from a few tables.
i've seen a similar problem at this post.
https://forums.ni.com/t5/LabVIEW/SQL-query-does-not-return-results/m-p/4103624#M1182428
If i Put "SET NOCOUNT ON;" i get the same results as before
does anyone have an idea?
12-15-2020 08:26 AM
Hi!
Your Query DOES return data, if you look at the probe.
The result has two rows and six columns, from which only the first and last contain data:
| 702 | | | | | costa |
| 704 | | | | | asd |
What do you get when you run the query with an other database client? Are those fields NULL ?
NULL means there is absolutely nothing in the field. Not a number of value 0, not an empty string, just nothing.
In LV, this translates to an empty variant.
Maybe, this columns have a weird data type?
12-16-2020 02:06 AM - edited 12-16-2020 02:07 AM
i did not test other clients, the weird thing is other table get loaded completely and some do not.
the data type is the same - int or strings. for all my tables.
if I select just column per column, i get all values. But if I try to select a hole row i get some empty cells..
12-16-2020 06:35 AM
Hi!
It is hard to say if there is a problem with Labview, if you don't know what the real result from the DB is.
Therefore, please use a client like Microsoft SqlServer Management Studio or similar, and run the same query there.
It is entirely possible that labview shows the result correctly, but the result is different from what you expect.
12-16-2020 08:06 AM
i've tried the same query in managament studio - i get all values. Just in Labview i do not get all values
12-16-2020 09:13 AM
Give us some more information here... What is the output supposed to look like? How many rows are there supposed to be?
Try doing a SELECT count(*) on the table and see if the result is 2 or the correct number of rows.
Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.
12-17-2020 12:51 AM - edited 12-17-2020 12:58 AM
here are the results
I do not get the same reslults by the same query.
if i replace the "NO COUNT ON " with "SET NOCOUNT OFF" i get an error message
I also tried to select the values just per coulmn and then i get the missing values
this shows one of the missing columns
12-17-2020 01:07 AM
Can you share your (example?/real) LabVIEW code?
It certainly seems like something odd is happening, but the screenshots of the probe window don't allow much in the way of debugging.
The linked forum thread discusses using the Fetch All + Next Recordset options - given you know you have 2 results (I suppose), you might be able to do that instead of the SET NOCOUNT ON toggle.
If you know the number of recordsets (seemingly SELECT statements) then you might not need the 'fix' (quotes because I don't know if it has either a) since been fixed officially, or b) been obviated in some other way) mentioned by DavidBoyd.