我现在正在制作我的贷款管理应用程序,我只是想问一下在VB.Net中查看贷款数据的最佳方法是什么?顺便说一句,我使用MySQL作为数据库。
答案 0 :(得分:-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