2017-08-24 10 views
0

私はこのサプライヤのためのデータベースwxpython GUIを持っています。新しいサプライヤの機能を挿入します。私はこのエラーの原因を見つけることができません。この関数は、エラーが発生している場所とともに以下のとおりです。新しいデータを挿入するとsqlite3の操作エラーが発生する

def insertNew(self,event): 

     with con: 
       cur = con.cursor() 

       cur.execute("INSERT OR IGNORE INTO Suppliers (Supplier, Code, Commodity, Contact, Number, EmailContact, TechnicalContact, TechnicalContactEmail, Address,) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)", 
          (self.text_list[0].GetValue(), self.text_list[1].GetValue(), self.text_list[2].GetValue(), self.text_list[3].GetValue(), self.text_list[4].GetValue(), 
           self.text_list[5].GetValue(), self.text_list[6].GetValue(), self.text_list[7].GetValue(), self.text_list[8].GetValue())) 
       con.commit() 

エラーはエラーがどこから来ている

Traceback (most recent call last): 
    File "C:\Users\ONP1LDY\eclipse-workspace\WOrk\SupplierDB.py", line 169, in insertNew 
    self.text_list[5].GetValue(), self.text_list[6].GetValue(), self.text_list[7].GetValue(), self.text_list[8].GetValue())) 
sqlite3.OperationalError: near ")": syntax error 

は誰もが見ることができるのですか?

+0

self' 'の次の行にあなたのインデントは前のものと一致しません – Mangohero1

+1

あなたはアドレスの後にカンマを持っていますそれはそこにあるべきではありません。変更: TechnicalContactメール、住所、TechnicalContactメール、住所 –

答えて

2

あなたはそれが別の列識別子を待っています、Adressの後にコンマを削除する必要があります。

cur.execute("INSERT OR IGNORE INTO Suppliers (Supplier, Code, Commodity, Contact, Number, EmailContact, TechnicalContact, TechnicalContactEmail, Address) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)", 
          (self.text_list[0].GetValue(), self.text_list[1].GetValue(), self.text_list[2].GetValue(), self.text_list[3].GetValue(), self.text_list[4].GetValue(), 
           self.text_list[5].GetValue(), self.text_list[6].GetValue(), self.text_list[7].GetValue(), self.text_list[8].GetValue())) 
+0

うん!ありがとうございました – mickNeill

関連する問題