Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Data binding question

Posted on 2006-10-30
5
Medium Priority
?
222 Views
Last Modified: 2010-04-16
Hi experts,

I want to create a simple windows form using VS2005 C# 2.0 to do the following:
1) It has a binding navigator, a group of radio buttons to filter records and a datagridview control.
2) they are all bind to a single table in SQL server.
3) the radio button is to filter groups of records in the table.
4) the navigator has add, delete and save button to allow user to insert,
        update,delete and save the changes back to the table (based on the
        filtered critria).
       
Could you advice on the steps to do the above?
Your help is appreciated.
0
Comment
Question by:michellechan57
  • 2
  • 2
5 Comments
 
LVL 11

Expert Comment

by:Mihai Stancescu
ID: 17840136
I think will be helpful if you create you select base on the radio selected.
I mean, for example, you can do this:
 if (radio1.Checked)
 {
     sqlString = "select top 10 * from Table1";
 }
and so on... (depending on how many radio buttons you have, and how many filters you can create on that table...)

And then you can use this string to pass it to the SqlCommand component.
Afterwards you can use the binding navigator to add, delete, or update the records...

Hope helps.
Regards,
Mishu  
0
 
LVL 3

Accepted Solution

by:
zajda82 earned 1500 total points
ID: 17840578
I would put one layer between SQL data and DataGrid.

Bind data between SQL and DataView object. DataView has a RowFilter property, which could help you to apply your radio buttons filters. Then set this DataView as a DataSource of your Grid.
0
 

Author Comment

by:michellechan57
ID: 17840660
Sorry guys, appreciate if you can elaborate a bit more. Thanks.

0
 
LVL 11

Expert Comment

by:Mihai Stancescu
ID: 17840706
You need a code example?
0
 

Author Comment

by:michellechan57
ID: 17842543
If it helps to understand.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question