如何将控件名称与文本值进行比较

时间:2015-11-30 16:42:51

标签: vb.net

我试图循环遍历所有控件并在除了两个以外的所有文本框上分配text_changed处理程序,但是以下代码不起作用它继续进入if并将处理程序分配给这些文本框。使用IsNot代替<>不起作用

def userlogin(self, ID, password):
        try:
            statement = conn.execute('SELECT ID FROM USERS')

            for row in statement:
                if ID in row:  # compare one by one
                    print "%d" % ID
                    pas = conn.execute('SELECT PASSWORD FROM USERS WHERE ID = %d' % (ID))

                    if password in pas:
                        print "welcome user %d" % ID

                    else:
                        print "password incorrect!" # ID is matched
                    conn.close()
                    return 
            print "Incorrect ID! If you are not a user, please register here."
        except IOError:
                print "Select statement could not execute!"
        finally:
                conn.close()

0 个答案:

没有答案