Advertisement
Guest User

Untitled

a guest
May 24th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 KB | None | 0 0
  1. def init__database(self, command, user, password, host, port):
  2.     if command == 'CONNECT':
  3.         self.db = MySQLdb.connect(host, port=port, user=user, passwd=password)
  4.     elif command == 'DISCONNECT':
  5.         # buat fungsi untuk reset form `user, password, host, & port` ke default.
  6.         return self.db.close()
  7.  
  8. def oke(self, Event=None):
  9.     self.user=self.E_user.get()
  10.     self.password=self.E_passw.get()
  11.    
  12.     try:
  13.         # disini self.db.cursor() sudah bisa dipake.
  14.         #self.db = MySQLdb.connect("localhost",port=3306, user=self.user, passwd=self.password)#, db="perbankan" )
  15.         self.cursor = self.db.cursor()
  16.         self.showdata.configure(state=NORMAL)
  17.         print 'sukses'
  18.     except MySQLdb.OperationalError:
  19.         ....
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement