|
| Master Detail Table update using Tableadapter in web application |
 |
Thu, 27 Mar 2008 12:06:22 +000 |
I have Two tables OrganisationM and OrganisationDetail for that I have One Typed
Dataset as OrgDS
I write follwing code for update but OrganisationDetail.OrganisationID is Not
updated with related value in Organisation Please help me for that its urgentDim
ObjdsOrg AsNew DSOrganisation
Dim ObjDAorg AsNew DSOrganisationTableAdapters.OrganizationTableAdapter
Dim ObjDAOrgDetail AsNew
DSOrganisationTableAdapters.OrganizationDetailTableAdapterDim drOrg As
DSOrganisation.OrganizationRow = ObjdsOrg.Organization.NewOrganizationRow
drOrg.OrganizationName = txtorgname.Text
drOrg.Director = txtDirector.Text
drOrg.OrgAddress = txtaddress.Text
drOrg.OrgEmail = txtOrgEmail.Text
drOrg.OrgFaxNo = txtFPhoneNo.Text
drOrg.OrgPhoneNo = txtFPhoneNo.Text
drOrg.OrgPhoneNo = txtPhoneNo.Text
drOrg.OrgWebsite = txtwebsite.Text
drOrg.OrgCityID = drplstCity.SelectedValue
ObjdsOrg.Organization.AddOrganizationRow(drOrg)
Dim drorgDetail As DSOrganisation.OrganizationDetailRow =
ObjdsOrg.OrganizationDetail.NewOrganizationDetailRow
drorgDetail.OrganizationID = drOrg.OrganizationID
drorgDetail.SubCategoryID = drplstsubcat.SelectedValue
drorgDetail.SchemeID = drplstScheme.SelectedValue
drorgDetail.RegDate = Today
drorgDetail.RegExpireDate = Today
ObjdsOrg.OrganizationDetail.AddOrganizationDetailRow(drorgDetail)
ObjDAorg.Update(ObjdsOrg)
ObjDAOrgDetail.Update(ObjdsOrg)
ObjdsOrg.OrganizationDetail.AcceptChanges()
|
| Post Reply
|
| Re: Master Detail Table update using Tableadapter in web application |
 |
Tue, 1 Apr 2008 11:17:17 +0000 |
Hi,
Did you get any error message? If there is the PK relationship between master
and detail tables, you need to insert the master table first, and then insert
detail table.
Based on the code above, you can try to call master object's AcceptChanges
method before ObjdsOrg.OrganizationDetail.AcceptChanges().
If this doesn’t help you, please feel free to let me know.
I hope this helps.
|
| Post Reply
|
|
|
|
|
|
|
|
|
|