Buenos días, estoy tratando de hacer un insert en VB.NET y me da el siguiente
error:
Excepción no controlada del tipo
'System.InvalidCastException' en microsoft.visualbasic.dll
Información adicional: Cast from string "insert into wo(id, id_user, id_c"
to type 'Double' is not valid.
Para ver si pueden ayudarme aquí les muestro el insert:
enddate = Me.dtenddate.Value
requestdate = Me.dtreqdate.Value
Dim strConn As String = "Server=MYSRVR;Password=MYPWD; Persist Security
Info=True;User ID=sa;Initial Catalog=wo" 'String Connection to DB
Dim conn As New SqlConnection(strConn)
Dim objdrnum As SqlCommand
Dim sqlnum As String = "insert into wo(id, id_user, id_country, id_soft,
id_prog, id_phone, wotype, cycle, requestdate, enddate, requestact,
description, observations, status, new) values ('" _
+ Me.lblcode.Text + "', " _
+ userid + ", " _
+ Me.countrycombo.SelectedIndex + 1 + ", " _
+ Me.softwarecombo.SelectedIndex + 1 + ", " _
+ Me.progcombo.SelectedIndex + 1 + ", " _
+ Me.phonecombo.SelectedIndex + 1 + ", " _
+ 1 + ", " _
+ Me.cyclecombo.SelectedIndex + 1 + ", '" _
+ requestdate + "', '" _
+ enddate + "', '" _
+ Me.txtactivity.Text + "', '" _
+ Me.txtobservations.Text + "', " _
+ 1 + ", " _
+ 1 + ")"
Dim Cmdnum As New SqlCommand(sqlnum, conn)
conn.Open()
objdrnum.ExecuteNonQuery()
objdrnum.Connection.Close()
Leer las respuestas