locked
display data according to the query in text boxes RRS feed

  • Question

  • User1429399154 posted

    good afternoon programmers friend if someone made me a hand I am making an application for registration of vehicles
    I have problems displaying data in a box
    this my code in the data layer
    as called from a form to display data

    data layer

      Public Function GetCode(Code As Integer) As List(Of Vlog_Entry)
            Dim Conn As New SqlConnection(conexion.Connectionstring)
            Dim Cmd As New SqlCommand
            Dim vehicles_list As List(Of Vlog_Entry) = Nothing
            Try
                Conn.Open()
                Cmd.CommandText = "Select Placa,Date_Time_Entry,code From entry_Vehicle Where code = @code"
                Cmd.CommandType = CommandType.Text
                Cmd.Connection = Conn
                Cmd.Parameters.Add("@code", SqlDbType.Int).Value = code
                Dim reader As SqlDataReader = Cmd.ExecuteReader
                Dim eentry_vehicle As Vlog_Entry = Nothing
                If reader.HasRows Then
                    vehicles_list = New List(Of Vlog_Entry)
                    While reader.Read
                        eentry_vehicle = New Vlog_Entry
                        eentry_vehicle .IdTicker = reader.GetInt32(0)
                        eentry_vehicle .Placa = If(reader.IsDBNull(1), "", reader.GetString(1))
                        eentry_vehicle .Date_Time_Entry = If(reader.IsDBNull(2), Nothing, reader.GetDateTime(2))
                        eentry_vehicle.Code = If(reader.IsDBNull(3), "", reader.GetString(3))
                         vehicles_list .Add(eentry_vehicle)
                    End While
                End If
                reader.Close()
            Catch ex As Exception
                Throw New Exception(ex.Message)
            Finally
                If Conn.State = ConnectionState.Open Then
                    Conn.Close()
                    Conn.Dispose()
                End If
            End Try
            Return ListaVhiculos
        End Function

    I need to display the data according to this query the text boxes

    txtplaca.txt
    txtcode.txt
    txtDate_Time_Entry.txt

    business layer

     Public Function GetCodigo(Code As Integer) As List(Of Vlog_Entry)
            Dim obj_Entry_Vehicle As New DaoInsertTicker
            Try
                Return obj_Entry_Vehicle.GetCode(Code)
    
            Catch ex As Exception
                Throw New Exception(ex.Message)
            End Try
        End Function

    Wednesday, October 12, 2016 10:03 PM

All replies