Record delete

jeva39

Well-known member
Joined
Jan 28, 2005
Messages
135
Location
Panama
Programming Experience
1-3
Please, I need the correct code to delete a record in a Sql Database. I use this code, but although don´t generate any error, neither delete the record (the CommandBuilder generate all the commands correctly)

VB.NET:
Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click
	Try
	  Dim dtr As DataRow
	  dtr = Me.dst.Tables("Ayuda").Rows(Me.IposAct)
	  dtr.Delete() 
	  Dim oTemp As DataTable
	  oTemp = Me.dst.Tables("Ayuda").GetChanges(DataRowState.Deleted)
	  Me.dta.Update(oTemp)
	  Me.dst.Tables("Ayuda").AcceptChanges()
	  Me.btnPri.PerformClick() ' reset to first record
	Catch eUpdate As System.Exception
	  System.Windows.Forms.MessageBox.Show(eUpdate.ToString())
	End Try
  End Sub
 
Top Bottom