Advertisement
Guest User

errors

a guest
Nov 24th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. Public Function AddCareTaker(ByVal user As String, ByVal pass As String, ByVal name As String, ByVal address As String, ByVal birthdate As String, ByVal phone As String)
  2. If (AddCaretakerLogin(user, pass)) Then
  3. AddCaretakerContact(CheckId, name, address, birthdate, phone)
  4. Return True
  5. Else
  6. Return False
  7. End If
  8. End Function
  9. Public Sub RemoveCareTaker(ByVal id As Int16, ByVal uid As Int16)
  10. RemoveCaretakerInfo(id)
  11. RemoveCaretakerLogin(uid)
  12. End Sub
  13. Private Function CheckId()
  14. Dim DT As DataTable = ShowCaretakersIds()
  15. Dim IdOrder As Int16 = DT.Rows(DT.Rows.Count - 1)(0)
  16. Return IdOrder
  17. End Function
  18. Private Function AddCaretakerLogin(ByVal user As String, ByVal pass As String)
  19. sqlCommand.CommandText = "INSERT INTO [dbo].[login] ([Username],[Password],[AuthorityLevel]) Values" &
  20. " (@user,@pass,0)"
  21. sqlCommand.Parameters.AddWithValue("@user", user)
  22. sqlCommand.Parameters.AddWithValue("@pass", pass)
  23. sqlCommand.CommandTimeout = 3000
  24. sqlConnection.Open()
  25. Dim Result As Integer
  26. Try
  27. Result = sqlCommand.ExecuteNonQuery
  28. Catch ex As Exception
  29. MessageBox.Show(ex.ToString())
  30. Finally
  31. If sqlConnection.State = ConnectionState.Open Then
  32. sqlConnection.Close()
  33. End If
  34. End Try
  35. Return Result
  36. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement