Click here to Skip to main content
15,667,735 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all

I want to display data on date wise in a gridview.e.g. today if they enter some data then tomorrow it should not show those data..
means grid should contain only that day's data..
please tell me how to do that
i am useing vb.net 08 desktop application
Posted
Updated 24-Sep-12 1:43am
v2
Comments
ridoy 24-Sep-12 8:02am    
then your database should have date column..and do query for ordering all of your data according to datewise and then select top 1 from your table for a day.
[no name] 24-Sep-12 8:14am    
can u plz give me idea about the query..???

You can do this while fetching data from sql server. Just prvoide date condition while fetching data.

like where date = getdate()
 
Share this answer
 
Comments
[no name] 24-Sep-12 8:14am    
can u plz give me idea about the query..???
Abhijit Parab 24-Sep-12 8:28am    
select * from table_name where date = getdate()
Hi,
Here is the code-
VB
Dim con As New OleDbConnection(connection_String)
       Dim Query As String = "select * from table_name where date_column='" & getdate()
       Dim Da As OleDbDataAdapter
       Ds As New DataSet 
       Dtb As New System.Data.DataTable
       con.Open()
       Da = New OleDbDataAdapter(Query, con)
       Da.Fill(Ds)
       con.Close()
       Dtb = Ds.Tables(0)
       GridView1.DataSource = Dtb
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900