Hello
I am programming in Delphi 2006 using the TSQLQuery for the first time and have not been successful.
I have a MSSQL database called FDD and it has a table called USERS. I am trying to list only the USERS in a DBGrid that start with "G".
I have done the following:
1. Added a TSQLConnection component called SQL SQLConnectionFDD.
2. Added a TSQLDataSet component called SQLDataSetUSERS which has the SQL Connection value set to SQLConnectionFDD.
3. Added a TDataSetProvider component called DataSetProviderUSERS which has the DataSet value set to SQLDataSetUSERS.
4. Added the TClientDataSet component called ClientDataSetUSERS which has the ProviderName set to DataSetProviderUSERS
5. Added the TDataSource component called DataSourceUSERS which has the DataSet set to ClientDataSetUSERS.
6. Added the TDBGrid component called DBGridUSERS which has the DataSource set to DataSourceUSERS.
At this point I have no problem to see all the records in the USERS table in the DBGrid.
I now want to reduce what is being shown in the DBGrid.
I then add the TSQLQuery component called SQLQueryUSERS which has the DataSource set to DataSourceUSERS and the SQL Connection value set to SQLConnectionFDD. I also set the SQL value to "SELECT * FROM USERS WHERE USER_ID WHERE LIKE 'G%'". I also set the component to Active.
It still lists all the records.
What am I doing wrong?
Regards,
Georges
I am programming in Delphi 2006 using the TSQLQuery for the first time and have not been successful.
I have a MSSQL database called FDD and it has a table called USERS. I am trying to list only the USERS in a DBGrid that start with "G".
I have done the following:
1. Added a TSQLConnection component called SQL SQLConnectionFDD.
2. Added a TSQLDataSet component called SQLDataSetUSERS which has the SQL Connection value set to SQLConnectionFDD.
3. Added a TDataSetProvider component called DataSetProviderUSERS which has the DataSet value set to SQLDataSetUSERS.
4. Added the TClientDataSet component called ClientDataSetUSERS which has the ProviderName set to DataSetProviderUSERS
5. Added the TDataSource component called DataSourceUSERS which has the DataSet set to ClientDataSetUSERS.
6. Added the TDBGrid component called DBGridUSERS which has the DataSource set to DataSourceUSERS.
At this point I have no problem to see all the records in the USERS table in the DBGrid.
I now want to reduce what is being shown in the DBGrid.
I then add the TSQLQuery component called SQLQueryUSERS which has the DataSource set to DataSourceUSERS and the SQL Connection value set to SQLConnectionFDD. I also set the SQL value to "SELECT * FROM USERS WHERE USER_ID WHERE LIKE 'G%'". I also set the component to Active.
It still lists all the records.
What am I doing wrong?
Regards,
Georges