Solved

Data binding question

Posted on 2006-10-30
5
213 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 500 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
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!
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

803 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