1

我们使用 VB.net 对数据读取器(7 条记录)执行 mySQL 语句,然后通过下面的代码加载到数据表(新创建的 6 条记录?) - 当涉及数据表时,第一条记录似乎潜逃 - 我无法理解为什么 - 你智慧最受赞赏。

SQL = "SELECT Count(total) as 'Inv #', CONCAT(DATE_FORMAT(DATE, '%m'), '/', DATE_FORMAT(DATE, '%Y')) AS Month, SUM(total) AS 'Total' FROM (tblinvoices) GROUP BY DATE_FORMAT(DATE, '%m%Y') ORDER BY Month DESC"
                Try
                    myCommand.Connection = MysqlConn
                    myCommand.CommandText = SQL
                    myAdapter.SelectCommand = myCommand
                    myData = myCommand.ExecuteReader()
                    myData.Read()     <- perfect 7 records
                Catch ex As MySqlException
                    MsgBox(ex.Number & ", " & ex.Message)
                Finally
                    Dim MyInvoiced As New DataTable
                    MyInvoiced.Load(myData) <- 6 records???
4

1 回答 1

0

不用线试试。

myData.Read()

它使您处于第二个记录。

于 2013-09-04T15:36:59.343 回答