0

请你帮助我好吗?我只想通过 Visual Basic 获取 mysql 数据库中表的第一行。我更喜欢简单的代码。我发现的唯一一件事是使用一段时间,我不想要的东西。提前致谢!

4

1 回答 1

0

尝试这样的事情

Try
    Dim sql As String = "SELECT first_row FROM test_table WHERE id = 1"
    Dim cmd as OleDbCommand
    cmd = New OleDbCommand(sql, Reconnect)
    Dim itmReader as SqlDataReader
    itmReader = cmd.ExecuteReader
    If itmReader.Read Then
        Dim firstRowData as String
        firstRowData = itmReader.Item("first_row")
        MessageBox.Show(firstRowData)
    End If
Catch ex As Exception
    MsgBox(ex.Message)
End Try
于 2013-08-20T16:08:50.927 回答