在datagridview中显示数据时需要帮助

问题描述:

大家好

我想在gridview中按日期显示数据.今天如果他们输入一些数据,那么明天就不应该显示这些数据.
表示表格只应包含当天的数据.
请告诉我该怎么做
我正在使用vb.net 08桌面应用程序

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

您可以在从sql server中获取数据时执行此操作.在获取数据时仅设置日期条件即可.

例如date = getdate()
You can do this while fetching data from sql server. Just prvoide date condition while fetching data.

like where date = getdate()



这是代码-
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