Could not get data

Hi,

this is working:

FAbteilungsleiter := FManager.Find<Tfawst>.Where(
  Linq.Sql<Integer>('{wst_fi} = ?', FFirma) and
  Linq.Sql<string>('{wst_art} = ?', 'abteilltr')
).OrderBy('wst_nr').List;

This is retrieving data:

FObGruppe1 := FManager.Find<Tfawst>.Where(
//  Linq.Sql<Integer>('{wst_fi} = ?', FFirma) and
  Linq.Sql<string>('{wst_art} = ?', 'obgruppe1') and
  Linq.Sql<Int64>('{wst_nr} = ?', 0)
).List;

But this is not retrieving any data:

FObGruppe1 := FManager.Find<Tfawst>.Where(
  Linq.Sql<Integer>('{wst_fi} = ?', FFirma) and
  Linq.Sql<string>('{wst_art} = ?', 'obgruppe1') and
  Linq.Sql<Int64>('{wst_nr} = ?', 0)
).List;

This does not retrieve any data, too:

FObGruppe1 := FManager.Find<Tfawst>.Where(
 (Linq['wst_fi'] = FFirma)
  and (Linq['wst_art'] = 'obgruppe1')
  and (Linq['wst_nr'] = 0)
).List;

How can this be?

mysql> DESC fawst;

+------------------------------+---------------+------+-----+---------+-------+
| Field                        | Type          | Null | Key | Default | Extra |
+------------------------------+---------------+------+-----+---------+-------+
| wst_fi                       | int(11)       | NO   | PRI | 0       |       |
| wst_art                      | varchar(10)   | NO   | PRI |         |       |
| wst_nr                       | bigint(20)    | NO   | PRI | 0       |       |
...
mysql> SELECT wst_fi, wst_art, wst_nr, wst_obgr1bez FROM fawst WHERE wst_fi = 0 AND wst_art = "obgruppe1" AND wst_nr = 0\G
*************************** 1. row ***************************
      wst_fi: 0
     wst_art: obgruppe1
      wst_nr: 0
wst_obgr1bez: ABC
1 row in set (0,00 sec)

Please drop a TAureliusModelEvents component, use the OnSqlExecuting event and check the exact SQL statement being generated by each of the queries you tried. That might shed some light on it.

If still in doubt, please paste the generate SQL statements here so we can try to detect what's going on.

I found the error. The requested datasets unexpectedly had the wrong wst_fi.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.