Click here to Skip to main content
15,888,610 members
Home / Discussions / C#
   

C#

 
GeneralRe: PrintPreviewControl and HTML Pin
MumbleB11-Jun-11 1:19
MumbleB11-Jun-11 1:19 
GeneralRe: PrintPreviewControl and HTML Pin
dSolariuM12-Jun-11 2:32
dSolariuM12-Jun-11 2:32 
GeneralRe: PrintPreviewControl and HTML Pin
dSolariuM12-Jun-11 2:33
dSolariuM12-Jun-11 2:33 
AnswerRe: PrintPreviewControl and HTML Pin
Luc Pattyn12-Jun-11 2:55
sitebuilderLuc Pattyn12-Jun-11 2:55 
GeneralRe: PrintPreviewControl and HTML Pin
BobJanova12-Jun-11 22:11
BobJanova12-Jun-11 22:11 
QuestionSuggestions On How To Refactor This Pin
Kevin Marois10-Jun-11 14:02
professionalKevin Marois10-Jun-11 14:02 
AnswerRe: Suggestions On How To Refactor This Pin
BobJanova12-Jun-11 23:44
BobJanova12-Jun-11 23:44 
QuestionSaving changed data from a BindingSource Pin
tekturtle10-Jun-11 4:26
tekturtle10-Jun-11 4:26 
I have a C# 2010 Windows Forms project that accesses (primarily) two tables in a SQL Server 2008 database. Each table is accessed in two modes: active accounts and cancelled accounts, and both have to be visible and editable at the same time (user requirement). The way I have it set up now is to have one DataSet, one TableAdapterManager, two TableAdapters (one for each table) and four BindingSources (two for each table adapter; one for active, one for cancelled). I have FillBy/GetDataBy methods setup for each TableAdapter that fill my BindingSources correctly. This is the code I’m using for filling them:
htcActiveBindingSource.DataSource = this.htcTableAdapter.ActiveGetDataBy(gpn);
htcCancelledBindingSource.DataSource = this.htcTableAdapter.CancelledGetDataBy(gpn);
vetActiveBindingSource.DataSource = this.vetTableAdapter.ActiveGetDataBy(gpn);
vetCancelledBindingSource.DataSource = this.vetTableAdapter.CancelledGetDataBy(gpn);

Everything works exactly as I was hoping, except for saving. The code I was using for saving is this:
this.Validate();
this.htcActiveBindingSource.EndEdit();
this.htcCancelledBindingSource.EndEdit();
this.vetActiveBindingSource.EndEdit();
this.vetCancelledBindingSource.EndEdit();
this.tableAdapterManager.UpdateAll(this.cramdDataSet);

When I step through in debug mode, the current row in the BindingSource knows that it has been modified after the EndEdits run. However, when it executes the UpdateAll, nothing happens in the database. Playing around with it, I figured out that if I fill the TableAdapter directly, like this:
this.htcTableAdapter.ActiveFillBy(this.cramdDataSet.htc, gpn);

then it works, but only for just active or just cancelled, not both at the same time (it sets both binding sources to the same data). Is there some way to get the data from the independent BindingSources back into the TableAdapter? Or am I going to be forced to create a second table adapter for the cancelled versions of each table? Am I going about this in a completely retarded way? If so, please enlighten me! (As much as I’d like to make my code work, I’m not opposed to rewriting big chunks to do it the “right” way.) I’m also going to need to insert new records created from the form, but I haven’t gotten to that point yet since my basic save is not even working.

Thanks in advance!
AnswerRe: Saving changed data from a BindingSource Pin
BobJanova10-Jun-11 6:05
BobJanova10-Jun-11 6:05 
GeneralRe: Saving changed data from a BindingSource Pin
tekturtle10-Jun-11 10:04
tekturtle10-Jun-11 10:04 
GeneralRe: Saving changed data from a BindingSource Pin
BobJanova12-Jun-11 22:14
BobJanova12-Jun-11 22:14 
GeneralRe: Saving changed data from a BindingSource Pin
tekturtle15-Jun-11 11:57
tekturtle15-Jun-11 11:57 
GeneralRe: Saving changed data from a BindingSource [modified] Pin
BobJanova15-Jun-11 13:20
BobJanova15-Jun-11 13:20 
Questionsetup - include driver installation Pin
lukeer10-Jun-11 2:10
lukeer10-Jun-11 2:10 
AnswerRe: setup - include driver installation Pin
Dave Kreskowiak10-Jun-11 3:05
mveDave Kreskowiak10-Jun-11 3:05 
GeneralRe: setup - include driver installation Pin
lukeer10-Jun-11 3:31
lukeer10-Jun-11 3:31 
GeneralRe: setup - include driver installation Pin
Dave Kreskowiak10-Jun-11 3:53
mveDave Kreskowiak10-Jun-11 3:53 
QuestionList Of DataRow Pin
om_metab9-Jun-11 22:50
om_metab9-Jun-11 22:50 
AnswerRe: List Of DataRow Pin
V.9-Jun-11 22:57
professionalV.9-Jun-11 22:57 
AnswerRe: List Of DataRow Pin
BobJanova9-Jun-11 23:47
BobJanova9-Jun-11 23:47 
AnswerRe: List Of DataRow Pin
Pete O'Hanlon10-Jun-11 0:13
mvePete O'Hanlon10-Jun-11 0:13 
GeneralRe: List Of DataRow Pin
om_metab10-Jun-11 0:35
om_metab10-Jun-11 0:35 
QuestionDetecting USB devices Pin
majamer9-Jun-11 21:46
majamer9-Jun-11 21:46 
AnswerRe: Detecting USB devices Pin
Kim Togo10-Jun-11 0:23
professionalKim Togo10-Jun-11 0:23 
GeneralRe: Detecting USB devices Pin
majamer13-Jun-11 3:17
majamer13-Jun-11 3:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.