class StudentDB: def openDB(self): self.con=sqlite3.connect("students.db") self.cursor=self.con.cursor() def closeDB(self): self.con.commit() self.con.close() def initTable(self): res={} try: self.cursor.execute("create table students (No varchar(16) primary key,Name varchar(16), Sex varchar(8), Age int)") res["msg"]="OK" except Exception as err: res["msg"]=str(err) return res def selectRows(self): res={} try: data=[] __________________________________________________ __________________________________________________ for row in rows: d={} d["No"]=row[0] d["Name"]=row[1] d["Sex"]=row[2] d["Age"]=row[3] data.append(d) res["msg"]="OK" res["data"]=data except Exception as err: res["msg"]=str(err) return res从数据库中读出所有学生记录,缺失的语句是
A.
self.cursor.execute("select * from students order by No");rows=self.cursor.fetchall()
B.
self.con.execute("select * from students order by No");rows=self.con.fetchall()
C.
self.cursor.execute("select * from students order by No");rows=self.cursor.fetch()
D.
self.con.execute("select * from students order by No");rows=self.con.fetch()