我正在尝试使用此代码检查系统是否已存在具有此值的字段
Dim adap As New MySqlDataAdapter
Dim sqlquery = "SELECT * FROM client WHERE code ='"+ TxtCode.Text +"'"
Dim comand As New MySqlCommand()
comand.Connection = con
comand.CommandText = sqlquery
adap.SelectCommand = comand
Dim data As MySqlDataReader
data = comando2.ExecuteReader()
leitor.Read()
If (data(3).ToString) = code Then
MsgBox("already exists", MsgBoxStyle.Information)
TxtCode.ResetText()
TxtCode.Focus()
Else
Console.WriteLine(insert("INSERT INTO client (name, tel, code) VALUES ('" & name & "', '" & tel & "')"))
con.Close()
End If