Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Ground Controller Lvl 1
Message 1 of 3

Bookstore Management Project using PyQt and SQLite3

There is an exception cmg in the line    curbook.execute("INSERT INTO bookrecords (S.No.,book"+str(self.j)+") VALUES (?,?);",(self.s,no))   

I have used python , Qt Designer5 and SQLite3 to develop this code.

s,j variables are class attributes used in the class function. 'no' is a local attribute , defined inside searchbook() func.. curbook is the cursor object for the database.The name of table is also correct.Output is available in the attachment. PLEASE POINT OUT MY MISTAKE CAUSING THE ERRORScreenshot (263).png

2 Replies
Copilot Lvl 3
Message 2 of 3

Re: Bookstore Management Project using PyQt and SQLite3

I would try accessing your SQLite db through a separate client such as "DB Browser for SQLite". This will help in debugging db calls. Is S.No. correct?

 

Commander Lvl 1
Message 3 of 3

Re: Bookstore Management Project using PyQt and SQLite3

You'd get more information (which you should share here) if you either a) removed the exception handling, or b) printed the exception details as mentioned in one of the replies in here . Either way, we all would have more information about what the problem is.

 

You didn't share your "Create table bookrecords" code with us, so it is hard to tell if this is a problem or not, but the line in question will result in a SQL statement like:

insert into bookrecords (S.No.,book1) values (?,?);

which seems wrong: your column name ("book1") will change every time self.j changes, and I doubt your database schema is (or should be) set up that way.

 

For future reference, pasting the relevant text instead of a screen cap would be much better when asking for help in these forums.

 

Please follow-up to let us know how you made out. For good karma, mark a reply as the answer if it helped!