Actualizar mediante variable
Publicado por Farid (15 intervenciones) el 17/02/2017 16:45:24
buen dia me podrian ayudar por favor , quiero actualizar un texbox, por medio de una consulta de update, pero me arrojar un error que dice EL NOMBRE DE LA COMUNA WKDA32323, NO ES VALIDO, ese numero que aparece es por el cual quiero que se haga la actualizacion, pero no se que estoy haciendo mal, muchas gracias

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Dim con As New SqlConnection
Dim ticket As String
Dim cmd As New SqlCommand
ticket = DataGridView1.CurrentRow.Cells(1).EditedFormattedValue.ToString
Try
con.ConnectionString = "server=0.0.0.0.0\TICKETS;database=Ticket2017;user id = sa; password = pas"
con.Open()
cmd.Connection = con
cmd.CommandText = "update tickets SET respsistemas = @RCon where numticket =" + ticket
cmd.Parameters.AddWithValue("@RCon", Me.TextBox1.Text)
cmd.ExecuteNonQuery()
Catch ex As Exception
MessageBox.Show("Error while inserting record on table..." & ex.Message, "Insert Records")
Finally
End Try
con.Close()

Valora esta pregunta


0