你好我想用多个 MySQLdatareader 做 if 语句。我不知道它会工作与否。请有人帮我修复我的代码。这是我的示例代码。
Sub Emailusernameexist()
Dim sCommand1 As MySqlCommand = New MySqlCommand("SELECT * FROM account WHERE Email = '" & TextBox5.Text & "'", conn)
Dim sCommand2 As MySqlCommand = New MySqlCommand("SELECT * FROM account WHERE Username = '" & TextBox4.Text & "'", conn)
RD1 = sCommand1.ExecuteReader
RD2 = sCommand2.ExecuteReader
Try
If RD1.HasRows Then
While RD1.Read
Dim cname As String
cname = RD1.GetString("Completename")
MsgBox("Sorry, your email have been registered by " + cname + "? Please login !", vbInformation)
End While
ElseIf RD2.HasRows Then
While RD2.Read
Dim cname As String
cname = RD2.GetString("Completename")
MsgBox("Maaf, username was owned by " + cname + " !", vbInformation)
End While
End If
Catch ex As Exception
End Try
conn.close()
End Sub