Ver Mensaje Individual
  #2 (permalink)  
Antiguo 16/05/2002, 11:42
gallego
 
Fecha de Ingreso: abril-2002
Mensajes: 16
Antigüedad: 22 años, 1 mes
Puntos: 0
Re: Insertar Registro cómo Hipervínculo..(fácil?)

Me voy acercando, pero ahora me sale este error:

Object must implement IConvertible

Lo que hago básicamente es esto:

Sub AddNewRecord(Sender As Object, E As EventArgs)
Dim objCommand As OleDbCommand
Dim strSQLQuery As String
'Con esta variable intento crear un nuevo Link...
Dim myHyperLink As HyperLink = new HyperLink()
' Our insert command
strSQLQuery = "INSERT INTO tbdownloads " _
& "(NomFich, Enlace, DescF) " _
& "VALUES (@TextValue, @IntValue, @DTValue)"


objCommand = New OleDbCommand(strSQLQuery, objConnection)

' Add parameters that our SQL command takes:
objCommand.Parameters.Add(New OleDbParameter("@TextValue", OleDbType.VarChar, 255))
objCommand.Parameters.Add(New OleDbParameter("@IntValue", OleDbType.VarChar, 255))
objCommand.Parameters.Add(New OleDbParameter("@DTValue", OleDbType.VarChar, 255))

'Este es el texto que aparecerá en el link.

myHyperLink.Text = NomFich.value

'Y esta la ruta, que viene del formulario

myHyperLink.NavigateURL = Link.value

objCommand.Parameters("@TextValue").Valu e = NomFich.value

'Luego la meto desde aquí a la tabla, al valor que ya había definido antes para el insert into...

objCommand.Parameters("@IntValue").Value = myHyperLink
objCommand.Parameters("@DTValue").Value = DescF.value

' Open the connection, execute the command, and close the connection.
objConnection.Open()
objCommand.ExecuteNonQuery()
objConnection.Close()
ShowDataGrid
End Sub
----------------
El error debe andar en eso nuevo es decir por:

Dim myHyperLink As HyperLink = new HyperLink()

O algo así...

Alguna Idea??

Gracias por vuestro Tiempo!

Salvador Gallego.