本文介绍了如何在dbase中过滤日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,



我想访问dbase数据库并在.Net中填写DataGridView。当我尝试这个代码与传递日期值克劳斯没有过滤,但没有克劳斯其工作正常。请帮助这个



谢谢

Basit



 尝试 
Dim ConnectionString As 字符串
ConnectionString = Provider = vfpoledb;数据源= D:\ ATTEND.DBF;整理顺序=机器;
Dim dBaseConnection As System.Data.OleDb.OleDbConnection(ConnectionString)
dBaseConnection.Open()
Dim dataadapter As System.Data.OleDb。 OleDbDataAdapter( SELECT * FROM ATTEND.DBF#& Format(今天。日期, mm / dd / yy)& #和#&格式(今天。日期 mm / dd / yy )& ,dBaseConnection)
' Dim dataadapter As New System.Data.OleDb.OleDbDataAdapter(SELECT * FROM ATTEND.DBF,dBaseConnection)
Dim ds As DataSet()
dataadapter.Fill (ds, ATTEND
DataGridView1.DataSource = ds
DataGridView1。 DataMember = ATTEND
dBaseConnection.Close()
Catch ex As 例外

结束 尝试
解决方案



Dear,

I want to access dbase database and fill in DataGridView in .Net. When i tried this code with passing date value in where Claus not filtering, but without where Claus its working fine. Please help on this

Thanks
Basit

Try
    Dim ConnectionString As String
    ConnectionString = "Provider=vfpoledb;Data Source=D:\ATTEND.DBF;Collating Sequence=machine;"
    Dim dBaseConnection As New System.Data.OleDb.OleDbConnection(ConnectionString)
    dBaseConnection.Open()
    Dim dataadapter As New System.Data.OleDb.OleDbDataAdapter("SELECT * FROM ATTEND.DBF Where date between #" & Format(Today.Date, "mm/dd/yy") & "# and #" & Format(Today.Date, "mm/dd/yy") & "#", dBaseConnection)
    'Dim dataadapter As New System.Data.OleDb.OleDbDataAdapter("SELECT * FROM ATTEND.DBF", dBaseConnection)
    Dim ds As New DataSet()
    dataadapter.Fill(ds, "ATTEND")
    DataGridView1.DataSource = ds
    DataGridView1.DataMember = "ATTEND"
    dBaseConnection.Close()
Catch ex As Exception

End Try
解决方案



这篇关于如何在dbase中过滤日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 09:07