Solved

Data binding question

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
The Using statement in C# 5 37
Need help with a query 6 55
Why, and when, to use Windows Workflow 1 20
ConsoleSql 1 22
Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

744 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now