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
I need to display the data according to this query the text boxes
From your code. You will get a list<Vlog_Entry> form GetCode method. You want to display data according to the text boxes. I suggest you can use some collection controls to display the data. I listed some of the following
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Member
9 Points
47 Posts
display data according to the query in text boxes
Oct 12, 2016 10:03 PM|djnilo|LINK
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
I need to display the data according to this query the text boxes
txtplaca.txt
txtcode.txt
txtDate_Time_Entry.txt
business layer
Star
11464 Points
2439 Posts
Re: display data according to the query in text boxes
Oct 13, 2016 03:20 AM|Yohann Lu|LINK
Hi djnilo,
From your code. You will get a list<Vlog_Entry> form GetCode method. You want to display data according to the text boxes. I suggest you can use some collection controls to display the data. I listed some of the following
1: GridView
ASP.NET GridView control demo (VBASPNETGridView):
https://code.msdn.microsoft.com/VBASPNETGridView-19039173
2: ListView
Display (Show) data in ListView from database in ASP.Net using C# and VB.Net:
http://www.aspsnippets.com/Articles/Display-Show-data-in-ListView-from-database-in-ASPNet-using-C-and-VBNet.aspx
Best Regards,
Yohann Lu
Member
9 Points
47 Posts
Re: display data according to the query in text boxes
Oct 21, 2016 07:05 PM|djnilo|LINK
thanks yohann lu for replying but it is not what I need
I need info mostra according to sql query boxes txtbox
Star
11464 Points
2439 Posts
Re: display data according to the query in text boxes
Oct 26, 2016 05:24 AM|Yohann Lu|LINK
Hi djnilo,
You can get the values form textboxs. Then, pass these parameters to your SQL query.
How do I create a parameterized SQL query:
http://stackoverflow.com/questions/542510/how-do-i-create-a-parameterized-sql-query-why-should-i
Best Regards,
Yohann Lu