Guest User

Untitled

a guest
May 24th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. Private Sub btnGuardar_Click(sender As Object, e As EventArgs) Handles btnGuardar.Click
  2.  
  3. Try
  4. cmCon = New MySqlCommand
  5. adCon.Open()
  6. cmCon.Connection = adCon
  7. ''Dim query As String = "Insert into asistencia (fecha, tipoasistencia, idregistro) values(@fecha, @tipoasistencia, @idregistro)"
  8.  
  9. cmCon.CommandText = "Call spInsAsistencia(@fecha, @tipoasistencia, @idregistro)"
  10.  
  11. For Each row As DataGridViewRow In dgvAsistencia.Rows
  12. cmCon.Parameters.Clear()
  13. cmCon.Parameters.AddWithValue("@fecha", FormatoFecha(dtpFecha.Value))
  14. cmCon.Parameters.AddWithValue("@tipoasistencia", CStr(row.Cells(0).Value))
  15. cmCon.Parameters.AddWithValue("@idregistro", CStr(row.Cells(1).Value))
  16.  
  17. cmCon.ExecuteNonQuery()
  18.  
  19.  
  20. Next
  21.  
  22. MsgBox("Guardado correctamente", MsgBoxStyle.Information, "Información")
  23. frmAsistencias.ActualizarGrid()
  24.  
  25.  
  26.  
  27. Catch ex As Exception
  28. MsgBox(ex.Message)
  29. Finally
  30. adCon.Close()
  31. Me.Close()
  32.  
  33. End Try
  34.  
  35. End Sub
Add Comment
Please, Sign In to add comment