我在这里有堆栈但没有去我有一个连接到数据库的循环,但最近 2 天在计算行号时遇到问题。并且找不到解决方案
Dim row as Integer
For i = 100 To 120
Dim DBconn As MySql.Data.MySqlClient.MySqlConnection = New MySql.Data.MySqlClient.MySqlConnection(My.Settings.DBConnStr)
Dim da As MySql.Data.MySqlClient.MySqlDataAdapter
Dim dt As New DataTable
Dim sqlcmd As New MySql.Data.MySqlClient.MySqlCommand
sql = "SELECT Sum(D), Sum(P) FROM fin WHERE K like '" & i.ToString & "%' "
DBconn.Open()
da = New MySql.Data.MySqlClient.MySqlDataAdapter(sql, DBconn)
da.Fill(dt)
DBconn.Close()
row = dt.Rows.Count
MsgBox("i=" & i & " rows=" & row)
dt.Clear()
Next
MSG Box 总是告诉我 RowCount 是 1,当我手动查询 MYSQL Diferent i Gives me Diferent Rows 时。