创建非重复用户名数据库

时间:2017-12-16 10:32:14

标签: python database sqlite repeat fetchall

我写了def addmember来向database.db添加成员。我不想在用户名中重复,例如:当我向数据库添加成员(1,1)时,我无法将成员(1,2)添加到我的数据库,因为已经拥有用户名为“1”的用户。但我的代码仍然允许它!有人能帮我吗 ? self.textEdit.toPlainText(),self.textEdit_2.toPlainText()的节点只是我的qtextedit对象,不介意它

int x= 5;                       // this condition is given as an example
 for(int i=0 ; i<=50 ;i++){

    if(x==5){                       // this condition is given as an example

    new Handler().postDelayed(new Runnable() {
                @Override
                public void run() {
                   // what you want to do
                }
            },1000);  

       }
    }

1 个答案:

答案 0 :(得分:0)

你的召唤取消了两次。第一个获取所有行。第二个永远不会获得任何行,len将始终为0,因此您的插入将始终发生。