Results 1 to 4 of 4

Thread: Update (or complete) datagridview in certain cells

Threaded View

  1. #1

    Thread Starter
    Junior Member feroguz's Avatar
    Join Date
    Aug 2013
    Posts
    22

    Question Update (or complete) datagridview in certain cells

    Hi, good day!!

    I have a datagridview and I want to add values ​​(I have one combobox, 1 textbox and 2 datapicker).
    But I want to add the values ​​in the selected row, but I make mistakes.
    I appreciate any help in this difficult task:
    Name:  completar.jpg
Views: 516
Size:  54.7 KB

    Code:
          
     Dim estatus, notas, fecha_comp, fecha_cierre As String
            Dim i As Integer
    
            Dim conn As New MySqlConnection("Data Source=192.168.1.3;Database=mantenimiento;User ID=MGUZ;Password=Asdf1234;")
            conn.Open()
    
            Dim query As String = "UPDATE mantenimiento SET Estatus = ?estatus,Notas = ?notas,Fecha_comp = ?fecha_comp,fecha_cierre =?fecha_cierre" & "WHERE ID =" & txt_caso.Text & "')"
            estatus = DataGridView1.Rows.Item(i).Cells(8).Value
            notas = DataGridView1.Rows.Item(i).Cells(9).Value
            fecha_comp = DataGridView1.Rows.Item(i).Cells(10).Value
            fecha_cierre = DataGridView1.Rows.Item(i).Cells(11).Value
    
            Dim cmd As MySqlCommand = New MySqlCommand(query, conn)
            cmd.Parameters.AddWithValue("?estatus", estatus)
            cmd.Parameters.AddWithValue("?notas", notas)
            cmd.Parameters.AddWithValue("?fecha_comp", fecha_comp)
            cmd.Parameters.AddWithValue("?fecha_cierre", fecha_cierre)
    
    
            cmd.ExecuteNonQuery()
    
            conn.Close()
    Best Regards!!
    Last edited by feroguz; Sep 26th, 2013 at 05:56 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width