|
-
Apr 5th, 2010, 11:56 AM
#1
Thread Starter
New Member
Help with update using table adapter
Hi,
I have a form with comboboxes, if the user doesnt select a value in the box I want a null to be sent to the database.
The insert works fine, i look at the record in the db and see the null.
The update doesnt work. gives me a n "Update statement conflicted with foreign key constaint....."
Public Sub Update()
TableAdapterCreate().Update(ID1, ID2, CType(cbox1.SelectedValue, Integer), CType(cbox2.SelectedValue, Integer), CType(cbox3.SelectedValue, Integer), CType(cbox4.SelectedValue, Integer), CType(cbox5.SelectedValue, Integer), CType(PostAssign.SOB.SelectedValue, Integer), CType(cbox6.SelectedValue, Integer), chkOther.Checked, Notes.Text)
End Sub
as I step through the selected value of the cbox 5 is shown as nothing (which it should be because the user didnt select a value for this combobox).
I assume this needs to be a null instead of nothing to get written to the database. the combox boxes need to match a primary key in another table so sending a 0 would also result in the forieign key error since the related table does not have a 0 ID field.
Thank you for your time and help
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|