如何在 VB.NET 中将 SQL WORKGROUP 2005 中的数据显示到我的标签?
到目前为止,这是我尝试过的:
Private Sub Label6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label6.Click
Dim strSQL As String
Dim Conn As OdbcConnection = New OdbcConnection("Label6=RATE")
strSQL = SELECT * FROM [PESORATE]
Dim catCMD As OdbcCommand = New OdbcCommand(strSQL, Conn)
Conn.Open()
Dim myReader As OdbcDataReader = catCMD.ExecuteReader()
If myReader.HasRows Then
Do While myReader.Read()
'the SqlDataReader returns typed data. You must use the
'proper get method for the type you are retrieving.
'(GetInt32, GetString, GetBoolean etc.)
Write(myReader.GetString(myReader.GetOrdinal([Rate]))))
Write("<BR>")
Loop
Else
Write("No records found!")
End If
myReader.Close()
Conn.Close()