View Complete Post
HI All,
For example
I have 2 tables Person and Person_Child.
In Person table i have columns
Id, PersonId,PersonName,PersonAdrress,PersonAge,RowId
1,101,JAck,NJ,30,12
rowid is identity
and in the person_child table--here parentrowid refers to parent table rowid and again rowid is identity here
Id, PersonId,PersonName,PersonAdrress,PersonAge,ParentRowid,RowId
1,101,JAck,NJ,30,12,1
1,101,null,null,null,12,2
I need to update the child table values as it is in parent tables where it is null.
I have to do for many tables.
Is there any way to do it dynamically.
Thanks,
JR
Hi, I am using Table Adapter to insert records into my database. I first insert my member record into the database and it has no errors, after that i insert the contact records into the table. however I got the following error:
You cannot add or change a record because a related record is required in table 'Member'.
This is my code:
ds.Member.Rows.Add(newMemRow) For index = 0 To contactList.Items.Count - 1 newContactRow.memberIc = memRow.nric newContactRow.number = CType(contactList.Items.Add(index), String) ds.Contacts.Rows.Add(newContactRow) Contactdt = CType(ds.Contacts.GetChanges, dbDataSet.ContactsDataTable) If Contactdt IsNot Nothing Then Try addContactTA.Update(Contactdt) MsgBox("Contacts have been added into database") Catch ex As Exception End Try End If Next Memdt = CType(ds.Member.GetChanges,dbDataSet.MemberDataTable) If Memdt IsNot Nothing Then Try addMemTA.Update(Memdt) MsgBox("Member has been added into database") Me.Close() Catch ex As Exception MsgBox(ex.Message)
I have read the data of a excle file and captured the data into the dataset to a datatable, now that data is to be inserted into a SQL Server table using bulk copy option. I am using -
public bool BulkEnterData(DataTable dt, string tblName) { SqlBulkCopy bulk = new SqlBulkCopy(con); bulk.DestinationTableName = tblName; con.Open(); bulk.WriteToServer(dt); con.Close(); return true; }
ERROR Getting-A transport-level error has occurred when receiving results from the server. (provider: Shared Memory Provider, error: 0 - The pipe has been ended.)
How to resolve the above problem or any other solution is available.
Hall of Fame Twitter Terms of Service Privacy Policy Contact Us Archives Tell A Friend