Open defron opened 9 years ago
import sqlite3
conn = sqlite3.connect('memberdb.db') c = conn.cursor()
print "Opened database successfully";
cursor = conn.execute("SELECT ID, FirstName, LastName, Email, Phone, GradYear from PEOPLE") for row in cursor: print "ID = ", row[0] print "FIRSTNAME = ", row[1] print "LASTNAME = ", row[2] print "EMAIL = ", row[3] print "PHONE = ", row[4] print "GRADYEAR = ", row[5], "\n"
print "Displaying People table done successfully"; conn.close()
Hi @octaviolmos . We need to do everything in an object-oriented manner, so can you convert this to a class? Also remove all the print lines, as UI aspects need to be separated from the functional aspects of the program. Instead just return the data.
A database class with methods for opening the db, executing a sql statement, and closing the connection would be good places to start I think.
Look into using **kwargs for handling dynamic record updates and using a variable for determining table.
Make sure to use named parameters for updated data.
@vcao2279 @octaviolmos
database connector object needs to be created @octaviolmos