Re: Looking for code sample to inset master and detail typed recordset



I'm not exactly sure what you're trying to do or why you're taking this path, but Parents must be created before children. Didn't your mom talk to you about the birds and the bees?
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant, Dad, Grandpa
Microsoft MVP
INETA Speaker
www.betav.com
www.betav.com/blog/billva
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

"Fred Goodrum - Alemarck Corp." <FredGoodrumAlemarckCorp@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:10B575B4-0B2E-4E00-A15B-8B0CAC5FD881@xxxxxxxxxxxxxxxx
I've followed the wizard to create a dataset. This datset has two tables, one
master, and one child. I've also had the wizard create stored procedres for
select, insert,....
I am not binding the data. Instead I've taken a form and am inserting the
records manually (No selects, deletes, or updates). The code follows the
following logic.
A constraint violation is thrown when I add the master row. I believe that I
am not following the correct method to perform this update. Unfortunately,
Every book and search have gone to great detail to discuss alternate methods.

where is my misunderstanding in how this process should be written?

Dim sc As New Scenario
Dim dr As DataRow = sc.ScenarioDetail.NewRow()
Dim mr As DataRow = sc.ScenarioMaster.NewRow()
.
.
<Update row mr>
<update row dr >
.
.
dr.SetParentRow(mr)
sc.ScenarioMaster.Adduwm_QLSS_ScenarioMasterRow(mr)
sc.ScenarioDetail.Adduwm_QLSS_ScenarioDetailRow(dr)
Dim ma As New ScenarioTableAdapters.ScenarioMasterTableAdapter
Dim da As New ScenarioTableAdapters.ScenarioDetailTableAdapter
Dim rw As Integer
rw = ma.Update(sc)
rw = da.Update(sc)



.



Relevant Pages

  • Re: Treeview, sehr langsam
    ... Dim tv1 As TreeView ... Private Sub Form1_Load(ByVal sender As System.Object, ... Dim btn As New Button ... For Each drow1 As DataRow In dset.Tables.Rows ...
    (microsoft.public.de.german.entwickler.dotnet.vb)
  • Re: DataTable and Outer Join
    ... into excel which is a bit cleaner than what you are doing here. ... DataRow dro = SecondarySampleTable.NewRow; ... > Dim XLFileConn As New OleDbConnection 'New OleDbConnection object ... > Dim XLFileCmd1 As New OleDbCommand 'New OleDbCommand object ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: alle Felder einer DataRow auslesen mittels Schleife
    ... Ich will nicht jedes Feld der DataRow angeben, ... Private mDT As DataTable ... Private Sub CreateData() ... Dim R As New Random ...
    (microsoft.public.de.german.entwickler.dotnet.datenbank)
  • Re: Retrieving table fields from access DB
    ... Here's how I got this list; tableName is passed in as a String. ... Dim cn As New SqlConnection ... For Each row As DataRow In tbl.Rows ... MessageBox.Show("Error opening the connection to the database.") ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Treeview, sehr langsam
    ... Dim tv1 As TreeView ... Private Sub Form1_Load(ByVal sender As System.Object, ... Dim btn As New Button ... For Each drow2 As DataRow In drow1.GetChildRows ...
    (microsoft.public.de.german.entwickler.dotnet.vb)