Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. con.Open()
  2. Dim Cliente As String
  3. Dim Nome As String
  4. Dim Data As String
  5. Dim Tempo As String
  6. Dim Descricao As String
  7. Dim Solucao As String
  8. Dim Conta As Integer
  9.  
  10. Try
  11. Cliente = TextBox1.Text
  12. Nome = TextBox2.Text
  13. Data = DateTimePicker1.Value
  14. Tempo = TextBox3.Text
  15. Descricao = TextBox6.Text
  16. Solucao = TextBox5.Text
  17.  
  18. Dim sql As String = "Insert into Assistencias " &
  19. "Values ('" & Cliente & "', '" &
  20. Nome & "', '" & Data & "', '" & Tempo & "', '" & Descricao & "', '" & Solucao & "')"
  21. Dim sqlcom As New SqlCommand(sql, con)
  22. Conta = Conta + Tempo
  23. Dim sql2 As String = "Insert into Test (HorasGastas) " &
  24. "Values ('" & Conta & "')"
  25. Dim sqlcom2 As New SqlCommand(sql2, con)
  26.  
  27. Dim nr As Integer
  28. nr = sqlcom.ExecuteNonQuery()
  29. MsgBox("Registo efetuado com sucesso!", MsgBoxStyle.Information, "InfTek Solutions")
  30. Catch Exc As Exception
  31. MsgBox("Erro na inserção de dados", MsgBoxStyle.Critical, "InfTek Solutions")
  32. Exit Try
  33. End Try
  34. con.Close()
  35. Me.Close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement