我的mysql数据库中有一个表:
ID First_Name Second_Name Age RFID_Tag Amount_Serve
--------------------------------------------------------------
1 John Smith 28 hdgdYun8JH Small
2 George Mark 35 kdjfHluhHB Big
并将此代码用于mysql查询
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim str As String = "Server=localhost;Port=3306;Database=namesdb;Uid=root;Pwd=1234"
Using con As New MySqlConnection(str)
Dim query As String = "select * from namedata where rfid_tag=@rfid"
Dim cm As New MySqlCommand(query, con)
con.Open()
cm.Parameters.Add("@rfid", MySqlDbType.VarChar).Value = TextBox3.Text
Dim rd As MySqlDataReader = cm.ExecuteReader()
' Check if any rows exist
If rd.HasRows = True Then
MessageBox.Show("trun on sm")
Else
MessageBox.Show("Not your time")
End If
End Using
End Sub
我想要的是,当textbox3.text中的rfid标签等于表中的rfid标签时,我要使用if函数形式,如果rfid数量服务于small run python脚本,则为small,如果big run脚本,则为big,我认为是要重放:
If rd.HasRows = True Then
如果amount\u server=small,那么
我希望我已经说清楚了,对这个案子有什么帮助吗。
1条答案
按热度按时间bfrts1fy1#
首先感谢@tetsuyayamamoto给我的提示!
解决方案如下:
谢谢大家