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 ERROR

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?

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.