Click here to Skip to main content
15,902,114 members
Home / Discussions / C#
   

C#

 
AnswerRe: C# Generics help PinPopular
harold aptroot20-Oct-10 6:06
harold aptroot20-Oct-10 6:06 
GeneralRe: C# Generics help Pin
gi122621-Oct-10 2:59
professionalgi122621-Oct-10 2:59 
QuestionVS designer (C#) Pin
kapax520-Oct-10 4:53
kapax520-Oct-10 4:53 
QuestionHow to sniff traffic of only one application Pin
rahul.kulshreshtha20-Oct-10 4:05
rahul.kulshreshtha20-Oct-10 4:05 
QuestionProblem with adding new record to the datagridview with Master/Child relationship Pin
Hardz20-Oct-10 0:47
Hardz20-Oct-10 0:47 
AnswerRe: Problem with adding new record to the datagridview with Master/Child relationship Pin
rah_sin20-Oct-10 1:07
professionalrah_sin20-Oct-10 1:07 
GeneralRe: Problem with adding new record to the datagridview with Master/Child relationship Pin
Hardz20-Oct-10 14:39
Hardz20-Oct-10 14:39 
GeneralRe: Problem with adding new record to the datagridview with Master/Child relationship Pin
Hardz20-Oct-10 15:27
Hardz20-Oct-10 15:27 
Hi,

I think i found the best solution using this code below:

void save()
{
Validate();
// Disable constraints
ds.EnforceConstraints = false;
DsMasterDetail.MasterRow master = (DsMasterDetail.MasterRow)(((DataRowView)masterBindingSource.Current).Row);
DsMasterDetail.DetailRow detail = (DsMasterDetail.DetailRow)(((DataRowView)detailBindingSource.Current).Row);
masterBindingSource.EndEdit();
masterTableAdapter.Update(master);
detail.MasterId = master.MasterId;
detailBindingSource.EndEdit();
detailTableAdapter.Update(detail);
//Re-enable constraints
ds.EnforceConstraints = true;
}

This code solves my problem with Fk_Constraint. Actually it is working only for single data entry at details data table, but the only problem is that when adding a new Master at the textbox along with multiple details at the datagridview at the same time, coz it only fires up the last record of the datagrid and bypasses the corresponding rows. I need help for this problem.

Thanks.

Hardz
AnswerRe: Problem with adding new record to the datagridview with Master/Child relationship Pin
PIEBALDconsult20-Oct-10 3:21
mvePIEBALDconsult20-Oct-10 3:21 
GeneralRe: Problem with adding new record to the datagridview with Master/Child relationship Pin
Hardz20-Oct-10 14:33
Hardz20-Oct-10 14:33 
GeneralRe: Problem with adding new record to the datagridview with Master/Child relationship Pin
PIEBALDconsult21-Oct-10 3:06
mvePIEBALDconsult21-Oct-10 3:06 
AnswerRe: Problem with adding new record to the datagridview with Master/Child relationship Pin
Hardz28-Oct-10 23:56
Hardz28-Oct-10 23:56 
QuestionNeed help Pin
rksreadero19-Oct-10 16:33
rksreadero19-Oct-10 16:33 
AnswerRe: Need help Pin
JF201519-Oct-10 18:15
JF201519-Oct-10 18:15 
AnswerRe: Need help Pin
Abhinav S19-Oct-10 23:18
Abhinav S19-Oct-10 23:18 
GeneralRe: Need help Pin
Nish Nishant20-Oct-10 4:04
sitebuilderNish Nishant20-Oct-10 4:04 
GeneralRe: Need help Pin
Keith Barrow20-Oct-10 7:58
professionalKeith Barrow20-Oct-10 7:58 
AnswerRe: Need help Pin
Ravi Bhavnani20-Oct-10 4:53
professionalRavi Bhavnani20-Oct-10 4:53 
Question{"Restore failed for Server '\\\\.\\pipe\\3F103E6E-3FD4-47\\tsql\\query'. "} Pin
Mohammad Dayyan19-Oct-10 15:25
Mohammad Dayyan19-Oct-10 15:25 
QuestionExecuteNonQuery problem? [modified] Pin
Emmet_Brown19-Oct-10 8:21
Emmet_Brown19-Oct-10 8:21 
AnswerRe: ExecuteNonQuery problem? Pin
Luc Pattyn19-Oct-10 8:33
sitebuilderLuc Pattyn19-Oct-10 8:33 
AnswerRe: ExecuteNonQuery problem? Pin
Maciej Los19-Oct-10 8:42
mveMaciej Los19-Oct-10 8:42 
GeneralRe: ExecuteNonQuery problem? Pin
Emmet_Brown19-Oct-10 8:47
Emmet_Brown19-Oct-10 8:47 
AnswerRe: ExecuteNonQuery problem? Pin
Maciej Los19-Oct-10 9:12
mveMaciej Los19-Oct-10 9:12 
AnswerSOLVED Pin
Emmet_Brown19-Oct-10 11:04
Emmet_Brown19-Oct-10 11:04 

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.