X
xan
Here is want I and writting. It works, but it delete another record not the
only where I click the command delete button.
What I'm doing wrong?
' -------------------------------------------------------------------------
Sub dgDatos_Delete(obj As object, e As DataGridCommandEventArgs)
Dim strSQL As String = "DELETE FROM datos " & _
"WHERE numero = " & e.Item.ItemIndex & ";"
ExecuteStatement(strSQL)
LlenarDatosDeCuadricula()
lblMensaje.Text = lblMensaje.Text & e.Item.cells(0).Text
End Sub
' ----------------------------------------------------------------------
function ExecuteStatement(strSQL)
Dim objCmd As New OleDbCommand(strSQL, Conn)
try
objCmd.Connection.Open()
lblmensaje2.text=""
objCmd.ExecuteNonQuery()
catch ex As Exception
lblMensaje.Text = "consulta:<br>" & strSQL & "<br>Error al
actualizar la base de datos.<br> " & ex.tostring()
End try
objCmd.Connection.Close()
End function
' --------------------------------------------------------------------------
only where I click the command delete button.
What I'm doing wrong?
' -------------------------------------------------------------------------
Sub dgDatos_Delete(obj As object, e As DataGridCommandEventArgs)
Dim strSQL As String = "DELETE FROM datos " & _
"WHERE numero = " & e.Item.ItemIndex & ";"
ExecuteStatement(strSQL)
LlenarDatosDeCuadricula()
lblMensaje.Text = lblMensaje.Text & e.Item.cells(0).Text
End Sub
' ----------------------------------------------------------------------
function ExecuteStatement(strSQL)
Dim objCmd As New OleDbCommand(strSQL, Conn)
try
objCmd.Connection.Open()
lblmensaje2.text=""
objCmd.ExecuteNonQuery()
catch ex As Exception
lblMensaje.Text = "consulta:<br>" & strSQL & "<br>Error al
actualizar la base de datos.<br> " & ex.tostring()
End try
objCmd.Connection.Close()
End function
' --------------------------------------------------------------------------