Click here to Skip to main content
12,444,635 members (55,655 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VB 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
Code-Hunt7.1K
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.
snehasish nandy 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 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()
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
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160811.3 | Last Updated 26 Sep 2012
Copyright © CodeProject, 1999-2016
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