0

我现在正在制作我的贷款管理应用程序,我只想问在 VB.Net 中查看贷款​​数据的最佳方法是什么?顺便说一句,我使用 MySQL 作为数据库。

4

1 回答 1

-1

这是我希望可以帮助阅读 SQL 的东西,它可能需要一些编辑和构建,但我仍然希望它有所帮助。

Dim conString As String = "data source=ServerName;" & _
                            "initial catalog=DBName;" & _
                            "integrated security=SSPI;" & _
                            "persist security info=false;"

Dim conSQL As New SqlConnection(conString)

conSQL.Open()

Dim cmdSQL As New SqlCommand()
cmdSQL.CommandType = Data.CommandType.Text
cmdSQL.CommandText = "SELECT FieldName1, FieldName2 FROM MyTable"

Dim adptSQL As New SqlClient.SqlDataAdapter(cmdSQL)
Dim myDataSet As New DataSet()
adptSQL.Fill(myDataSet)

conSQL.Close()

With myDataSet.Tables(0)
    For rowNumber As Integer = 0 To .Rows.Count - 1
        With .Rows(rowNumber)
            Console.WriteLine(String.Format("Field1: {0}, Field2: {1}", _
                                            .Item(0).Value.ToString, _
                                            .Item(1).Value.ToString))
        End With
    Next
End With
于 2013-09-23T09:09:18.403 回答