none
vb2008 DaTaSet 連結ACCESS資料異常 RRS feed

  • 問題

  • Public Class Form1

        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim ConnectionStr As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=d:\MASS.mdb"
            Dim Connection As New OleDb.OleDbConnection(ConnectionStr)

            Dim SQLCommand As String = "Select * From MASS"
            Dim DataAdapter As New OleDb.OleDbDataAdapter(SQLCommand, Connection)
           

            DataAdapter.Fill(DataSet1, "MASS")

            Dim Line1 As Integer = DataSet1.Tables("MASS").Rows.Count

    End Sub
    End Class

     我的MASS.DBM共有377列資料,第一個欄位是"順序",內容為1,2,3....377,並設為索引鍵,但奇怪的事發生了,
    從監看式查看myitem=DataSet1.Tables(1).Rows(i).Item(0) ,當i=0~24時 myitem=1~25,但i=25~36時,myitem卻為368,369,371,371,372,366,367...377,到i=37後myitem=26,一直到i=376時,myitem=365, i與myitem一直維持11的差距,為什麼會這樣呢,有沒有解決的方法啊!

       

    2010年7月13日 上午 05:41

解答

所有回覆