code

#操作sqlite
#id,book_name,book_user_name,book_url,book_passwd,book_pic,book_category,book_synopsis,book_type,book_format,book_size,book_author_synopsis,payful


#连接数据库
conn=sqlite3.connect("db.sqlite3")
cursor=conn.cursor()


#查询语句
sql='''select * from booklist_bookinfoa'''


#增加语句
sql='''insert into user(id,name) values(1,'xiaoqiang')'''
cursor.execute(sql)


#删除语句
sql='''delete from user where id=1'''
cursor.excute(sql)


#修改语句
sql='''update user set name='xiaoming' where id=1'''
cursor.excute(sql)


#返回结果
results=cursor.execute(sql)
all_result=results.fetchall()


#打印
print(all_result)




#使用游标关闭数据库的链接
cursor.close()