Advertisement
Guest User

Untitled

a guest
May 20th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.88 KB | None | 0 0
  1.     def UpdateEvent(self,Eid,Ename="",Edescription="",dates =[]):
  2.  
  3.         self.EstablishConnection()
  4.  
  5.         try:
  6.  
  7.             query = "UPDATE Event SET "
  8.  
  9.             if Ename != "" and Edescription != "" :
  10.  
  11.                 query += "Ename = "+Ename+", Edescription = "+Edescription
  12.  
  13.             elif Ename != "" :
  14.  
  15.                 query += "Ename = " + Ename
  16.  
  17.             else :
  18.  
  19.                 query += "Edescription = "+Edescription
  20.  
  21.             query += " WHERE Eid = "+Eid
  22.  
  23.             self.cursor.execute(query)
  24.  
  25.  
  26.             if  dates!=[]:
  27.                 for i in dates:
  28.                     query ="UPDATE EventDates SET " + "Edate = " + i + " WHERE Eid = "+Eid
  29.                     self.cursor.execute(query)
  30.  
  31.             self.CloseConnection()
  32.             return True
  33.  
  34.         except :
  35.  
  36.             self.CloseConnection()
  37.             return False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement