# databaseManager.getDataSetByQuery(...)

**URL:** <https://forum.servoy.com/t/databasemanager-getdatasetbyquery/3138>\
**Category:** Classic Servoy\
**Created:** [November 25, 2004, 2:09pm UTC](https://forum.servoy.com/t/databasemanager-getdatasetbyquery/3138 "2004-11-25T14:09:11Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![anton.dorrestijn](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@anton.dorrestijn](https://forum.servoy.com/u/anton.dorrestijn)\
**Post date:** [November 25, 2004, 2:09pm UTC](https://forum.servoy.com/t/databasemanager-getdatasetbyquery/3138/1 "2004-11-25T14:09:11Z")

</div>

Hello,

I have a query that works with controller.loadRecords(…) but will not work with databaseManager.getDataSetByQuery(…).

Is it correct that the databaseManager.getDataSetByQuery(…) will not take multiple WHERE clauses with the AND operator?

Anton Dorrestijn

---

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [November 25, 2004, 2:27pm UTC](https://forum.servoy.com/t/databasemanager-getdatasetbyquery/3138/2 "2004-11-25T14:27:28Z")

</div>

Could you post your complete code?

You can use multiple where clauses and ANDs in your query, that is not the problem…

Basically, what you do is use getDataSetByQuery(…) to retrieve a dataset that you then load via controller.loadRecords(dataset).

---

<div class="post-metadata">

**Author:** ![anton.dorrestijn](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@anton.dorrestijn](https://forum.servoy.com/u/anton.dorrestijn)\
**Post date:** [November 25, 2004, 3:26pm UTC](https://forum.servoy.com/t/databasemanager-getdatasetbyquery/3138/3 "2004-11-25T15:26:17Z")

</div>

It was my mistake, the databaseManager.getDataSetByQuery(…) wouldn’t load the records because it didn’t met the where clause. (note to myself: check that first next time…)

Funny part is that the controller.loadRecords(…) loaded the records even when the query should not find records with the given where clause…

Anyway, the getDataSetByQuery(…) is of no use to me, it doesn’t allow to create records. I wanted to use it to prevent the annoying “flickering” of the user interface.

Anton

---

<div class="post-metadata">

**Author:** ![Jan\_Blok](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@Jan\_Blok](https://forum.servoy.com/u/Jan_Blok)\
**Post date:** [November 29, 2004, 8:56pm UTC](https://forum.servoy.com/t/databasemanager-getdatasetbyquery/3138/4 "2004-11-29T20:56:58Z")

</div>

> anton.dorrestijn:  
> Funny part is that the controller.loadRecords(…) loaded the records even when the query should not find records with the given where clause…

Seems strange to us, if the query is wrong or has no results the form shows no records.  
Are you sure the query is correct? and does not return results?

---

<div class="post-metadata">

**Author:** ![anton.dorrestijn](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@anton.dorrestijn](https://forum.servoy.com/u/anton.dorrestijn)\
**Post date:** [November 30, 2004, 9:59pm UTC](https://forum.servoy.com/t/databasemanager-getdatasetbyquery/3138/5 "2004-11-30T21:59:11Z")

</div>

> Seems strange to us, if the query is wrong or has no results the form shows no records.

Hi Jan,

I wil check it again and post my findings.

Anton

---

<div class="post-metadata">

**Author:** ![anton.dorrestijn](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@anton.dorrestijn](https://forum.servoy.com/u/anton.dorrestijn)\
**Post date:** [December 6, 2004, 9:30am UTC](https://forum.servoy.com/t/databasemanager-getdatasetbyquery/3138/6 "2004-12-06T09:30:34Z")

</div>

Hi Jan,

Just got the latest update of servoy and my wooden shoe is breaking 😉

The controller.loadRecords( “querystring” ) is now returning:

Fout tijdens het laden van Primary Key data,The query does not have the correct number of pks in the select

While the databaseManager.getDataSetByQuery(…) now performs fine!

code used:

```auto
var _data = databaseManager.getDataSetByQuery( controller.getServerName(), _qry, null, 20 );
controller.loadRecords( _data );

```

---

<div class="post-metadata">

**Author:** ![Jan\_Blok](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@Jan\_Blok](https://forum.servoy.com/u/Jan_Blok)\
**Post date:** [December 6, 2004, 10:04am UTC](https://forum.servoy.com/t/databasemanager-getdatasetbyquery/3138/7 "2004-12-06T10:04:16Z")

</div>

It seems to me you do select more than the PK columns, pls verify all the conditions for the SQL as found in sample code/docs.

---

<div class="post-metadata">

**Author:** ![anton.dorrestijn](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@anton.dorrestijn](https://forum.servoy.com/u/anton.dorrestijn)\
**Post date:** [December 6, 2004, 11:19am UTC](https://forum.servoy.com/t/databasemanager-getdatasetbyquery/3138/8 "2004-12-06T11:19:38Z")

</div>

Hi Jan,

You’re right, not all cols are pk cols → corrected → it works now.

Anton
