Foros del Web » Programación para mayores de 30 ;) » .NET »

No puede Actualizar los datos con el DATAGRID en ASP.NET

Estas en el tema de No puede Actualizar los datos con el DATAGRID en ASP.NET en el foro de .NET en Foros del Web. Private Sub DataGrid1_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles DataGrid1.UpdateCommand Dim nombre As String Dim direccion As String Dim telefono As String ...
  #1 (permalink)  
Antiguo 01/01/2003, 22:17
 
Fecha de Ingreso: septiembre-2002
Mensajes: 7
Antigüedad: 21 años, 7 meses
Puntos: 0
No puede Actualizar los datos con el DATAGRID en ASP.NET

Private Sub DataGrid1_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles DataGrid1.UpdateCommand
Dim nombre As String
Dim direccion As String
Dim telefono As String
Dim id As String

id = CType(e.Item.Cells(2).Controls(0), TextBox).Text
nombre = CType(e.Item.Cells(3).Controls(0), TextBox).Text
direccion = CType(e.Item.Cells(4).Controls(0), TextBox).Text
telefono = CType(e.Item.Cells(5).Controls(0), TextBox).Text

UPDATECommand.CommandText = "UPDATE contactos SET nombre= @nombre, direccion = @direccion, telefono =@telefono WHERE id = @id"

UPDATECommand.Parameters.Add("@id", OleDb.OleDbType.VarChar, 11).Value = id
UPDATECommand.Parameters.Add("@nombre", OleDb.OleDbType.VarChar, 11).Value = nombre
UPDATECommand.Parameters.Add("@direccion", OleDb.OleDbType.VarChar, 40).Value = direccion
UPDATECommand.Parameters.Add("@telefono", OleDb.OleDbType.VarChar, 20).Value = telefono

Conexion.Open()
UPDATECommand.Connection = Conexion
UPDATECommand.ExecuteNonQuery()
DataGrid1.EditItemIndex = -1
DataGrid1.DataBind()
Conexion.Close()
End Sub

Este es mi codigo, saque el string de coneccion para que no sea tan extenso. No me actualiza los cambios en la base.
Y CUANDO LO DEBUGEO, me doy cuenta de que los text.box no levantan los cambios....

QUE TENGO MALLLLL????????????
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 17:53.