Wenas, en el siguiente código me da error al coger el campo "codi" ya que es una columna enlazada ReadOnly y no me deja hacer la conversión a textbox.
Dim command As SqlClient.SqlCommand
con.Open()
Dim commandupdate As String = "UPDATE Noticia SET nottitol=titular, notdatpub=data, nottext=descripcio WHERE notid=codi;"
command = New SqlClient.SqlCommand(commandupdate, con)
command.Parameters.Add(New SqlClient.SqlParameter("codi", SqlDbType.Int, 4))
command.Parameters("codi").Value = CType(e.Item.Cells(1).Controls(0), TextBox).Text
command.Parameters.Add(New SqlClient.SqlParameter("titular", SqlDbType.VarChar, 100))
command.Parameters("titular").Value = CType(e.Item.Cells(2).Controls(0), TextBox).Text
command.Parameters.Add(New SqlClient.SqlParameter("descripcio", SqlDbType.VarChar, 5000))
command.Parameters("descripcio").Value = CType(e.Item.Cells(3).Controls(0), TextBox).Text
command.Parameters.Add(New SqlClient.SqlParameter("data", SqlDbType.SmallDateTime, 4))
command.Parameters("data").Value = CDate(CType(e.Item.Cells(4).Controls(0), TextBox).Text)
command.ExecuteNonQuery()
Alguien sabe como puedo coger el código? Es que siempre me da este error:
"El argumento especificado está fuera del intervalo de valores válidos. Nombre del parámetro: index"
Muchas gracias
Salu2
PD: Faltan los ('@') porque sino la web dice que no puedo colgar webs ni links.