Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL-Server VB.NET
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 24-Sep-12 1:42am
Edited 24-Sep-12 1:43am
v2
Comments
ridoy at 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.
snehasish nandy at 24-Sep-12 8:14am
   
can u plz give me idea about the query..???
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You can do this while fetching data from sql server. Just prvoide date condition while fetching data.
 
like where date = getdate()
  Permalink  
Comments
snehasish nandy at 24-Sep-12 8:14am
   
can u plz give me idea about the query..???
Abhijit Parab at 24-Sep-12 8:28am
   
select * from table_name where date = getdate()
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hi,
Here is the code-
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
  Permalink  

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

  Print Answers RSS
0 CHill60 575
1 Sergey Alexandrovich Kryukov 499
2 OriginalGriff 325
3 PIEBALDconsult 285
4 BillWoodruff 193


Advertise | Privacy | Mobile
Web04 | 2.8.141015.1 | Last Updated 26 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100