0
我在MS Access/VB.net下面的SQL查詢:如何從查詢中獲取數據集?
Dim sql = "SELECT [Product Name], [Customer Name], [Group Associated], [Customer Address], [Product Price], [Current Stock], [Date Ordered], [Volume Purchased] FROM (torder INNER JOIN tproducts ON tproducts.Product_ID = torder.Product_ID) INNER JOIN tcustomer ON torder.Customer_ID = tcustomer.Customer_ID WHERE torder.[Date Ordered] Between #" & StartOfTimePeriod & "# And #" & Today & "#;"
conn.Open()
Dim dataAdapter As New OleDbDataAdapter(sql, conn)
Dim ds As New DataSet()
dataAdapter.Fill(ds, "torder")
conn.Close()
DataGridView.DataSource = ds
DataGridView.DataMember = "torder"
當查詢時,它會不顯示完整的數據集,它應該。相反,結果幾乎是隨機的。什麼可能是錯的?
你在期待什麼?在msaccess中運行此查詢並使用應用程序運行時,您獲得了多少條記錄? – DevelopmentIsMyPassion 2014-12-08 09:21:43
數據庫表定義中的[Date Ordered]是什麼類型? – Steve 2014-12-08 09:22:30
[Date Ordered]是日期/時間 – Michael 2014-12-08 09:27:11