我是 vb.NET 和 SQL 的新手。我想查看我的 vb.NET 程序中的最新输入。我该怎么做?其中床号是自动递增的。目前,这确实记录了数据库中的更改,但是当我想查看详细信息时,标签仍然为空,它应该是。
这是我的代码:
Dim SQLStatement As String = "SELECT name, age, date_of_confinement,type_of_sickness, " _
"type_of_IV_fluid, number_of_bottles, drop_rate " _
"FROM patient WHERE bednumber=1"
Dim cmd As MySqlCommand = New MySqlCommand
With cmd
.CommandText = SQLStatement
.CommandType = CommandType.Text
.Connection = SQLConnection
.ExecuteNonQuery()
'--read the records in database in phpmyadmin gui---
Dim myReader As MySqlDataReader = cmd.ExecuteReader
If myReader.Read Then
ViewInfo.lblName.Text = myReader.GetString(0)
ViewInfo.lblAge.Text = myReader.GetString(1)
ViewInfo.lblDate.Text = myReader.GetString(2)
ViewInfo.lblSickness.Text = myReader.GetString(3)
ViewInfo.lblFluid.Text = myReader.GetString(4)
ViewInfo.lblBottle.Text = myReader.GetString(5)
ViewInfo.lblDrop.Text = myReader.GetString(6)
myReader.Close()
End If
End With
谢谢!