这就是我的表单的样子 - image。
当表单加载时,我想检索在 中的玩家数据username
,Label1
所以我可以points
在Label2
.
到目前为止,这是我的代码:
Dim conn As MySqlConnection
conn = New MySqlConnection("server=REMOVED;Port=REMOVED; user id=REMOVED; password=REMOVED; database=REMOVED")
Dim username As Boolean = True
conn.Open()
Dim sqlquery As String = "SELECT Name FROM NewTable WERE Name='" & My.Settings.Name & "';"
Dim data As MySqlDataReader
Dim adapter As New MySqlDataAdapter
Dim command As New MySqlCommand
command.CommandText = sqlquery
command.Connection = conn
adapter.SelectCommand = command
data = command.ExecuteReader
While data.Read()
Label1.Text = data(1).ToString
Label2.Text = data(3).ToString
End While
data.Close()
conn.Close()
任何帮助将非常感激。