No me funciona
Este es mi Código HTML:
Código:
<asp:TemplateColumn HeaderText="Borrar Usuario">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<ItemTemplate>
<asp:Button id="btnEliminar" runat="server" Text=" Eliminar " CausesValidation="False" CommandName="Delete"></asp:Button>
</ItemTemplate>
</asp:TemplateColumn>
Y en mi CodeBehind tengo:
Código:
Private Sub Grid_DeleteCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles Grid.DeleteCommand
Try
strSQL = "Delete From Usuarios WBhere usUsuario = '" & e.Item.Cells(1).Text & "'"
daDataAdapter.DeleteCommand = New SqlClient.SqlCommand(strSQL, cnn)
daDataAdapter.DeleteCommand.CommandType = CommandType.Text
cnn.Open()
daDataAdapter.DeleteCommand.ExecuteNonQuery()
cnn.Close()
lblError.Text = ""
Catch ex As Exception
lblError.Text = ex.Message
End Try
End Sub
Qué tengo mal?