Dim cmd As New SQLCommandcmd.CommandText = "Select Count(用户账号) From {xtuser} Where [用户账号] = '" & UserName & "'"If cmd.ExecuteScalar() = 0 Then Messagebox.show("账号不存在!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)End If
另外我觉得用UserName似乎不妥,应该用User.Name,我猜的。