Guest User

Untitled

a guest
Sep 10th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.35 KB | None | 0 0
  1. #Region "Método SELECT OBJECT BY Cliente (com ID diferente)"
  2. Public Shared Function SelectObject_ByTipoDiffID(ByVal theNome As String, ByVal theID As String, ByVal theTecnico As String, ByVal theValor As String, ByVal theNotas As String,
  3. ByVal theEstado As String, ByVal theProblema As String, ByVal theIntervencao As String,
  4. ByVal theData_Hora_Entrega As String, ByVal theData_Hora_Entrada As String, ByVal theEquipamento As String) As AssistenciasInfo
  5. Dim result As AssistenciasInfo = Nothing
  6. Dim myDBConnection As SqlConnection = Nothing
  7. Dim myDBCommand As SqlCommand
  8. Dim dr As SqlDataReader = Nothing
  9. Dim statement As String = "SP_AssistenciasSelectBy_DiffID"
  10. Try
  11. myDBConnection = New SqlConnection(ClientesUtils.ConnectionString)
  12. myDBConnection.Open()
  13. myDBCommand = New SqlCommand
  14. myDBCommand.Connection = myDBConnection
  15. myDBCommand.CommandText = statement.ToString
  16. myDBCommand.CommandType = CommandType.StoredProcedure
  17. With myDBCommand.Parameters
  18. '.Add(New SqlParameter("@ID", SqlDbType.Int))
  19. .Add(New SqlParameter("@NomeCliente", SqlDbType.NVarChar))
  20. .Add(New SqlParameter("@Equipamento", SqlDbType.NVarChar))
  21. .Add(New SqlParameter("@Problema", SqlDbType.NVarChar))
  22. .Add(New SqlParameter("@Data_Hora_Entrada", SqlDbType.NVarChar))
  23. .Add(New SqlParameter("@Data_Hora_Entrega", SqlDbType.NVarChar))
  24. .Add(New SqlParameter("@Tecnico", SqlDbType.NVarChar))
  25. .Add(New SqlParameter("@Intervencao", SqlDbType.NVarChar))
  26. .Add(New SqlParameter("@Valor", SqlDbType.NVarChar))
  27. .Add(New SqlParameter("@Notas", SqlDbType.NVarChar))
  28. .Add(New SqlParameter("@Estado_Reparacao", SqlDbType.NVarChar))
  29. End With
  30. 'myDBCommand.Parameters("@ID").Value = theid
  31. myDBCommand.Parameters("@NomeCliente").Value = theNome
  32. myDBCommand.Parameters("@Equipamento").Value = theEquipamento
  33. myDBCommand.Parameters("@Problema").Value = theProblema
  34. myDBCommand.Parameters("@Data_Hora_Entrada").Value = theData_Hora_Entrada
  35. myDBCommand.Parameters("@Data_Hora_Entrega").Value = theData_Hora_Entrega
  36. myDBCommand.Parameters("@Tecnico").Value = theTecnico
  37. myDBCommand.Parameters("@Intervencao").Value = theIntervencao
  38. myDBCommand.Parameters("@Valor").Value = theValor
  39. myDBCommand.Parameters("@Notas").Value = theNotas
  40. myDBCommand.Parameters("@Estado_Reparacao").Value = theEstado
  41. dr = myDBCommand.ExecuteReader()
  42. If dr.HasRows Then
  43. If dr.Read Then
  44. result = BuildObjectFromRow(dr)
  45. End If
  46. End If
  47. Catch ex As Exception
  48. Finally
  49. If Not dr Is Nothing Then
  50. dr.Close()
  51. End If
  52. If Not myDBConnection Is Nothing And
  53. myDBConnection.State = ConnectionState.Open Then
  54. myDBConnection.Close()
  55. End If
  56. End Try
  57. Return result
  58. End Function
  59. #End Region
Add Comment
Please, Sign In to add comment