A
Agnes
I can bind to both datagrid succesfully, However, if i only want to insert a
new row in header table, it fails, it seems I must insert detail table also.
--------------------------formload----
dsSeaExHBL_cntrmark.Clear()
daSeaExHBL_cntrmark.SelectCommand = New SqlCommand()
daSeaExHBL_cntrmark.SelectCommand.Connection = conSea
daSeaExHBL_cntrmark.TableMappings.Add("Table",
"BillLadingContainer")
daSeaExHBL_cntrmark.SelectCommand.CommandText = "select * from
billladingcontainer where number ='" & Trim(Me.pHBLNo) & "' order by
billladingcontainer.seqno "
daSeaExHBL_cntrmark.Fill(dsSeaExHBL_cntrmark,
"billladingcontainer")
daSeaExHBL_cntrmark.SelectCommand.CommandText = "select * from
billladingmarking where number ='" & Trim(Me.pHBLNo) & "' order by
billladingmarking.seqno "
daSeaExHBL_cntrmark.Fill(dsSeaExHBL_cntrmark, "billladingmarking")
Dim cb as commandbuilder(daSeaExHBL_cntrmark)
--------save----
Dim drCntr As DataRow =
dsSeaExHBL_cntrmark.Tables("BillLadingContainer").NewRow()
drCntr("number") = Trim(Me.pHBLNo)
drCntr("containerno") = Trim(Me.txtCntrNo.Text)
drCntr("filterkey") = Trim(Me.pHBLNo) & "@" &
CType(Me.txtSeqNo.Text, String) & "@" & Trim(Me.txtCntrNo.Text)
drCntr("sealno") = Trim(Me.txtSealno.Text)
dsSeaExHBL_cntrmark.Tables("BillLadingContainer").Rows.Add(drCntr)
daSeaExHBL_cntrmark.Update(dsSeaExHBL_cntrmark)<--- it return error. It said
i didn't insert marking.
[If I only want to insert a record in header, how can i do that ??]
Thanks a lot
new row in header table, it fails, it seems I must insert detail table also.
--------------------------formload----
dsSeaExHBL_cntrmark.Clear()
daSeaExHBL_cntrmark.SelectCommand = New SqlCommand()
daSeaExHBL_cntrmark.SelectCommand.Connection = conSea
daSeaExHBL_cntrmark.TableMappings.Add("Table",
"BillLadingContainer")
daSeaExHBL_cntrmark.SelectCommand.CommandText = "select * from
billladingcontainer where number ='" & Trim(Me.pHBLNo) & "' order by
billladingcontainer.seqno "
daSeaExHBL_cntrmark.Fill(dsSeaExHBL_cntrmark,
"billladingcontainer")
daSeaExHBL_cntrmark.SelectCommand.CommandText = "select * from
billladingmarking where number ='" & Trim(Me.pHBLNo) & "' order by
billladingmarking.seqno "
daSeaExHBL_cntrmark.Fill(dsSeaExHBL_cntrmark, "billladingmarking")
Dim cb as commandbuilder(daSeaExHBL_cntrmark)
--------save----
Dim drCntr As DataRow =
dsSeaExHBL_cntrmark.Tables("BillLadingContainer").NewRow()
drCntr("number") = Trim(Me.pHBLNo)
drCntr("containerno") = Trim(Me.txtCntrNo.Text)
drCntr("filterkey") = Trim(Me.pHBLNo) & "@" &
CType(Me.txtSeqNo.Text, String) & "@" & Trim(Me.txtCntrNo.Text)
drCntr("sealno") = Trim(Me.txtSealno.Text)
dsSeaExHBL_cntrmark.Tables("BillLadingContainer").Rows.Add(drCntr)
daSeaExHBL_cntrmark.Update(dsSeaExHBL_cntrmark)<--- it return error. It said
i didn't insert marking.
[If I only want to insert a record in header, how can i do that ??]
Thanks a lot