我有一个读取和写入 Access 2016 数据库的应用程序,我刚刚将我的数据库和项目移动到了一台新计算机上,现在当我从 VB 运行 SELECT 命令时,它会向后读取日期(即 2018 年 7 月 11 日应该是11 月 7 日,但 VB 将其读取为 7 月 11 日)。
当我在 Access 07/11/2018 过滤器中按月过滤日期字段时,问题肯定出在 VB 而不是 Access 上,如 11 月。
是否需要设置某种全局设置?
这是代码:
Public Shared Sub Update_All()
Dim connectString As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & MainForm.mainDir & "\eBase.accdb"
Dim cn As OleDbConnection = New OleDbConnection(connectString)
cn.Open()
Dim selectString As String = "Select e_date, e_name FROM Results WHERE eRats Is Null Order By e_date ASC;"
Dim cmd As OleDbCommand = New OleDbCommand(selectString, cn)
Dim reader As OleDbDataReader = cmd.ExecuteReader()
While (reader.Read())
Update_R(reader("e_date").ToString, reader("e_name").ToString)
End While
reader.Close()
cn.Close()
End Sub