Click here to Skip to main content
15,900,666 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello expert,

I have two text field in a form one is Class Id in combo box,other is Section Id in checkboxlist,
for saving, I am writing a procedure save_class_section_mapping

create procedure class_section_mapping
@classId
@sectionId

as
begin
insert into class_section (class_id,section_Id) values (@classId,@sectionId)
end
go

when we update class_section table
duplicate rows are inserted into the table.

example:- we are saving 3 sections to 1st standard.when we update 1 more section to 1st standard, it adds extra 4 rows like..
1,1
1,2
1,3
1,1
1,2
1,3
1,4
this is my problem ,how to avoid these duplicate rows.


thanks and regards
vinay kumar
Posted
Updated 22-Oct-11 0:21am
v2

1 solution

Your question is a little unclear. But as I can guess you are using binding in WinForms? If that is the case you probably use a BindingSource[^], which can easily be reset with the Reset Method as follows:
C#
myBindingSource.Reset(false);

Also, when looking at the Property Grid for any bound Control under the Bindings section -> Advanced you can choose any of the following update methods: OnValidation and OnPropertyChanged. For checkboxes you probably want OnPropertyChanged. This causes your BindingSource to update whenever it is checked or unchecked rather than when it loses focus.

Hope this solves the problem.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900