stabilize datagrid sql criteria