VB.NET getReturn数据集总是给出相同的字符串

时间:2016-01-18 08:18:34

标签: vb.net

当我编写像这样的脚本

时,我遇到了vb.net的问题
 Dim main_class As New query_sync_desktop
 cn = MySQLi.MySQLConnectionMobile
 Query = "SHOW TABLES"
 da = New MySqlDataAdapter(Query, cn)
 ds = New DataSet
 ds.Clear()
 da.Fill(ds, "Tables_in_XXXXX")

 For i = 0 To ds.Tables(0).Rows.Count - 1
 MyTable = ds.Tables(0).Rows.Item(i).Item(0).ToString()
 MsgBox(MyTable)
 Next

它将显示我拥有的所有数据库,但是当我用于其他操作时#34; MyTable"总是显示相同的字符串。

 Dim main_class As New query_sync_desktop
 cn = MySQLi.MySQLConnectionMobile
 Query = "SHOW TABLES"
 da = New MySqlDataAdapter(Query, cn)
 ds = New DataSet
 ds.Clear()
 da.Fill(ds, "Tables_in_XXXXX")

 For i = 0 To ds.Tables(0).Rows.Count - 1
 MyTable = ds.Tables(0).Rows.Item(i).Item(0).ToString()
 Call main_class.getSyncron()
 Next

1 个答案:

答案 0 :(得分:0)

替换它:

MyTable = ds.Tables(0).Rows.Item(i).Item(0).ToString()

用这个:

MyTable = ds.Tables(0).Rows(i).Item(0).ToString

这里我假设您只想查看每行索引0的内容。