Foreign Keys and Relationships
I have a problem with relationships. I have two tables in sql 2005.
one table related to another. when i'm trying to delete a row in visual basic .net it says
"Update requires a valid DeleteCommand when passed DataRow collection with deleted rows"
I did my visual basic form with drag&drop stuff with datasource wizard.
i'm managing two bingingsource with one bindingnavigator. i guess that causes this problem but maybe not?
and i've one last question. i think we can set relationships in vb.net also . what should i do? should i set these relation in sql or visual basic? maybe it could be the constraint problem.
i'm so new about this .net please help me..
heres my code
Public
Class frm_anaPrivateSub BRD_TASARIM_TALEPBindingNavigatorSaveItem_Click(ByVal senderAs System.Object,ByVal eAs System.EventArgs)Handles BRD_TASARIM_TALEPBindingNavigatorSaveItem.Click
Try
Me.BRD_TASARIM_TALEPErrorProvider.Clear()
Me.BRD_TASARIMErrorProvider.Clear()
Me.Validate()
SelectCaseMe.TabControl1.SelectedIndex
Case 0
Me.BRD_TASARIM_TALEPBindingSource.EndEdit()
Me.BRD_TASARIM_TALEPTableAdapter.Update(Me.BNVTDataSet.BRD_TASARIM_TALEP)
Me.BRD_TASARIM_TALEPDataGridView.Refresh()
Case 1
Me.BRD_TASARIMBindingSource.EndEdit()
Me.BRD_TASARIMTableAdapter.Update(Me.BNVTDataSet.BRD_TASARIM)
Me.BRD_TASARIMDataGridView.Refresh()
EndSelect
MsgBox("??lem Tamamland?", MsgBoxStyle.Information,"Kay?tlar")
Catch
SelectCaseMe.TabControl1.SelectedIndex
Case 0
IfMe.TALEP_EDENTextBox.Text =""Then
Me.BRD_TASARIM_TALEPErrorProvider.SetError(Me.TALEP_EDENTextBox,"Bo? B?rak?lamaz")
ElseIfMe.KONUTextBox.Text =""Then
Me.BRD_TASARIM_TALEPErrorProvider.SetError(Me.KONUTextBox,"Bo? B?rak?lamaz")
Else
MsgBox("??lem Tamamlanamad?" & vbCrLf &"Hata: " & Err.Description, MsgBoxStyle.Critical,"Kay?tlar")
EndIf
Case 1
IfMe.TALEP_KODTextBox.Text =""Then
Me.BRD_TASARIMErrorProvider.SetError(Me.TALEP_KODTextBox,"Bo? B?rak?lamaz")
ElseIfMe.RAPORTextBox.Text =""Then
Me.BRD_TASARIMErrorProvider.SetError(Me.RAPORTextBox,"Bo? B?rak?lamaz")
Else
MsgBox("??lem Tamamlanamad?" & vbCrLf &"Hata: " & Err.Description, MsgBoxStyle.Critical,"Kay?tlar")
EndIf
EndSelect
EndTry
EndSub
PrivateSub Form1_Load(ByVal senderAs System.Object,ByVal eAs System.EventArgs)HandlesMyBase.Load
'TODO: This line of code loads data into the 'BNVTDataSet.BRD_TASARIM' table. You can move, or remove it, as needed.
Me.BRD_TASARIMTableAdapter.Fill(Me.BNVTDataSet.BRD_TASARIM)
'TODO: This line of code loads data into the 'BNVTDataSet.BRD_TASARIM' table. You can move, or remove it, as needed.
Me.BRD_TASARIMTableAdapter.Fill(Me.BNVTDataSet.BRD_TASARIM)
'TODO: This line of code loads data into the 'BNVTDataSet.BRD_TASARIM_TALEP' table. You can move, or remove it, as needed.
Me.BRD_TASARIM_TALEPTableAdapter.Fill(Me.BNVTDataSet.BRD_TASARIM_TALEP)
EndSub
PrivateSub tab_tasarim_Click(ByVal senderAs System.Object,ByVal eAs System.EventArgs)Handles tab_tasarim.Click
EndSub
PrivateSub TabControl1_SelectedIndexChanged(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles TabControl1.SelectedIndexChanged
SelectCaseMe.TabControl1.SelectedIndex
Case 0
Me.BRD_TASARIM_TALEPBindingNavigator.BindingSource = BRD_TASARIM_TALEPBindingSource
Case 1
Me.BRD_TASARIM_TALEPBindingNavigator.BindingSource = BRD_TASARIMBindingSource
EndSelect
EndSub
PrivateSub BindingNavigatorDeleteItem_Click(ByVal senderAs System.Object,ByVal eAs System.EventArgs)Handles BindingNavigatorDeleteItem.Click
EndSub
EndClass
and thats my relation picture in .net

