I am trying to delete a row/record in a database that i have as a dataset in my program. The following is my code:
I believe it is deleting it from the dataset, but not from my database. It is an sql database. I have tried numerous things, but cant figure this out. Any suggestions. What am i missing?
VB.NET:
Dim flightid As Integer = DirectCast(DirectCast(FlightplanBindingSource.Current, System.Data.DataRowView).Row, Flight_Test_App.FlightTestAppDataSet.flightplanRow).id
Dim chargeid As Integer = Me.ListBox1.SelectedValue
Dim foundrows() As Data.DataRow
foundrows = FlightTestAppDataSet.flightcharge.Select("flight_plan_id=" & flightid & " and charge_number_id=" & chargeid)
For Each dr As DataRow In foundrows
test = dr.Table.Rows.IndexOf((dr))
FlightTestAppDataSet.flightcharge.Rows(test).Delete()
Next
Me.FlightchargeBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.FlightTestAppDataSet)
I believe it is deleting it from the dataset, but not from my database. It is an sql database. I have tried numerous things, but cant figure this out. Any suggestions. What am i missing?