0

我在查找一个特定表的数据时遇到了问题。我已输出 SQL 语句并在 Access 中的查询中对其进行了测试,该查询找到了相关数据,但在代码中数据集返回零行。

Private m_comm As OleDbCommand
Private m_SQL As String
Private m_ds As New DataSet
Private m_dt As New DataTable
Private m_da As OleDbDataAdapter
Private m_bd As OleDbCommandBuilder

' bit of code to connect to database
m_conn = ...

m_comm = New OleDbCommand
m_comm.Connection = m_conn
m_SQL = "SELECT * FROM [TableName];"
m_ds = New DataSet
m_dt = New DataTable
m_da = New OleDbDataAdapter(m_SQL, m_conn)
Dim n As Integer = m_da.Fill(m_ds)

此时 n = 0

这是唯一发生这种情况的表。该表包含 1 行和两个字段。

我一直试图弄清楚可能会发生什么,但我需要另一双眼睛,以防我错过了显而易见的事情。我有其他具有相同配置的表,并且它们的 SQL 可以正常工作,因此问题不是 1 行....

4

0 回答 0