Windows Develop Bookmark and Share   
 index > Windows Forms General > BEST WAY TO DESIGN A DATABASE FILTER
 

BEST WAY TO DESIGN A DATABASE FILTER

Hi All,

I want to design a Windows Form which acts like a Filter . I need to dsplay inputs fields then user will give inputs based on the inputs i need to filter the database and display results. For numeric and Date fields i need to provide user to give operators like > < != ... I need best way to handle this using the latest controls.

Thanks
nothingisimpossible  Wednesday, September 09, 2009 4:47 AM
Hello,

Thanks for your post on MSDN forum.

It seems that you want to create something like the QueryBuilder of Visual Studio DataSource desiger. The QueryBuilder first display all the tables and views of the database and let the user select which table or view he/she wants to query. After the table is select, it list all the colums and users can select them.

I would like to suggest you take this logic to design your application. You use ADO.NET (SQL Provider) to get all the tables and views and put them into a ListBox control, if one of the tables is selected, list all the columns and let the user to choose the operators to create filters for each colum. Finally, using the select tables, columns and filters to generate the select SQL statement.

Here are some sample for your reference
http://www.codeproject.com/KB/database/SelectQueryBuilder.aspx
http://www.codeproject.com/KB/database/SQL_Builder.aspx
http://www.codeproject.com/KB/database/netquerybuilder.aspx

Thanks,
Rong-Chun Zhang
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg@microsoft.com
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Rong-Chun Zhang  Wednesday, September 09, 2009 7:06 AM
Hello,

Thanks for your post on MSDN forum.

It seems that you want to create something like the QueryBuilder of Visual Studio DataSource desiger. The QueryBuilder first display all the tables and views of the database and let the user select which table or view he/she wants to query. After the table is select, it list all the colums and users can select them.

I would like to suggest you take this logic to design your application. You use ADO.NET (SQL Provider) to get all the tables and views and put them into a ListBox control, if one of the tables is selected, list all the columns and let the user to choose the operators to create filters for each colum. Finally, using the select tables, columns and filters to generate the select SQL statement.

Here are some sample for your reference
http://www.codeproject.com/KB/database/SelectQueryBuilder.aspx
http://www.codeproject.com/KB/database/SQL_Builder.aspx
http://www.codeproject.com/KB/database/netquerybuilder.aspx

Thanks,
Rong-Chun Zhang
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg@microsoft.com
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Rong-Chun Zhang  Wednesday, September 09, 2009 7:06 AM

You can use google to search for other answers

Custom Search

More Threads

• changing IP address
• Wait Application..
• horizontal scroll bar on panel....not working
• ObjectDisposedException inconsistencies
• Windows Server 2K3
• creating project similar to outlook
• change native behavior of ComboBox - comboBox is hightlighted when changes its size
• Form/Panel Reset
• Font Size Scailing
• help Needed