I'm finally started to get ADO.NET, but I have a specific question.
I have two tables, BatchInfo and Data. BatchINFO has a BatchID field, and Data has a BatchID field too, as a there's a key relationship, requireing data to have a BatchID from BatchINFO, and not allowing BatchINFO data to be deleted if there's still data for that BatchID in the data table.
I'm Planning on doing updates like this:
I'll have a dataset, dsData that will have both tables.
Now, note that I haven't done a daAdapter.Update command to send these changes back to the database.
Now here's my question:
If someone CANCELS this operation, and I don't want to send ANY of this data to the database now, can I just do a dsData.RejectChanges and be done w/ it?
Do I have to go through the table objects and delete each of the rows I just added? How do I completely kill all the changes I just made?
Thanks In Advance!
--NipsMG s-)
I have two tables, BatchInfo and Data. BatchINFO has a BatchID field, and Data has a BatchID field too, as a there's a key relationship, requireing data to have a BatchID from BatchINFO, and not allowing BatchINFO data to be deleted if there's still data for that BatchID in the data table.
I'm Planning on doing updates like this:
I'll have a dataset, dsData that will have both tables.
Code:
Public Sub AddData(ByVal BatchId as Integer)
Dim tblBatchInfo as DataTable
Dim tblData as DataTable
tblBatchInfo = dsData.Tables("BatchInfo")
tblData = dsData.Tables("Data")
Dim rowCurrent as DataRow
rowCurrent = tblBatchInfo.NewRow()
rowCurrent("BatchID") = BatchID
'**** Fill IN BatchInfo Row *****
tblBatchInfo.Rows.Add(rowCurrent)
'***** Add some data *****
rowCurrent = tblData.NewRow
rowCurrent("BatchID") = BatchID
rowCurrent("Data") = "Data1"
tblData.Rows.Add(rowCurrent)
'***** Add some data *****
rowCurrent = tblData.NewRow
rowCurrent("BatchID") = BatchID
rowCurrent("Data") = "Data1"
tblData.Rows.Add(rowCurrent)
Now, note that I haven't done a daAdapter.Update command to send these changes back to the database.
Now here's my question:
If someone CANCELS this operation, and I don't want to send ANY of this data to the database now, can I just do a dsData.RejectChanges and be done w/ it?
Do I have to go through the table objects and delete each of the rows I just added? How do I completely kill all the changes I just made?
Thanks In Advance!
--NipsMG s-)