Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub btnGuardar_Click(sender As Object, e As EventArgs) Handles btnGuardar.Click
- Try
- cmCon = New MySqlCommand
- adCon.Open()
- cmCon.Connection = adCon
- ''Dim query As String = "Insert into asistencia (fecha, tipoasistencia, idregistro) values(@fecha, @tipoasistencia, @idregistro)"
- cmCon.CommandText = "Call spInsAsistencia(@fecha, @tipoasistencia, @idregistro)"
- For Each row As DataGridViewRow In dgvAsistencia.Rows
- cmCon.Parameters.Clear()
- cmCon.Parameters.AddWithValue("@fecha", FormatoFecha(dtpFecha.Value))
- cmCon.Parameters.AddWithValue("@tipoasistencia", CStr(row.Cells(0).Value))
- cmCon.Parameters.AddWithValue("@idregistro", CStr(row.Cells(1).Value))
- cmCon.ExecuteNonQuery()
- Next
- MsgBox("Guardado correctamente", MsgBoxStyle.Information, "Información")
- frmAsistencias.ActualizarGrid()
- Catch ex As Exception
- MsgBox(ex.Message)
- Finally
- adCon.Close()
- Me.Close()
- End Try
- End Sub
Add Comment
Please, Sign In to add comment