Solved -- .Addnew only works the first time
SOLVED
I can post code if needed but its rather long,,,
anyhow, I am trying to update my orderline table one line at a time using the .addnew method.
the first insert works find, the second time I use the .addnew method it tells me that you cannot insert a null value into a field... my question is why is it saying that if there is no record being written,,, i am just doing the .addnew then later on it performs the update.
I guess it could be better explained by the code.
--------------------------------------------
'Add a new Rental Item
bmRentalItem.AddNew()
'Set proper controls before writing update
txtVideoIDITEM.Text = Integer.Parse(txtVideoID.Text)
txtRentalNOITEM.Text = Integer.Parse(txtRentalNO.Text)
txtQty.Text = Integer.Parse(txtQTYITEM.Text)
chkPurchaseDB.Checked = chkPurchase.Checked
'Write the update
bmRentalItem.EndCurrentEdit()
daRentalItem.Update(DsRentalItem1)
DsRentalItem1.AcceptChanges()
I know there may be more efficient ways of doing this and I am all ears, but right now this is the only way I can figure out solo how to code it.
SOLVED
I can post code if needed but its rather long,,,
anyhow, I am trying to update my orderline table one line at a time using the .addnew method.
the first insert works find, the second time I use the .addnew method it tells me that you cannot insert a null value into a field... my question is why is it saying that if there is no record being written,,, i am just doing the .addnew then later on it performs the update.
I guess it could be better explained by the code.
--------------------------------------------
'Add a new Rental Item
bmRentalItem.AddNew()
'Set proper controls before writing update
txtVideoIDITEM.Text = Integer.Parse(txtVideoID.Text)
txtRentalNOITEM.Text = Integer.Parse(txtRentalNO.Text)
txtQty.Text = Integer.Parse(txtQTYITEM.Text)
chkPurchaseDB.Checked = chkPurchase.Checked
'Write the update
bmRentalItem.EndCurrentEdit()
daRentalItem.Update(DsRentalItem1)
DsRentalItem1.AcceptChanges()
I know there may be more efficient ways of doing this and I am all ears, but right now this is the only way I can figure out solo how to code it.
Last edited: