Guest User

Untitled

a guest
Aug 24th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. def details():
  2. rollnum = rnum.get()
  3. print(rollnum)
  4. conn = pymysql.connect(host='localhost', user='root', password='', db='data')
  5. a = conn.cursor()
  6.  
  7. a.execute("select * from student where rollno='"+rollnum+"'")
  8.  
  9. results = a.fetchall()
  10.  
  11. count = a.rowcount
  12.  
  13. print(results)
  14.  
  15. print(count)
  16.  
  17. if count > 0:
  18. for row in results:
  19. rnum1.set(row[0])
  20. sname.set(row[1])
  21. fanm.set(row[2])
  22. mtnm.set(row[3])
  23. dateob.set(row[4])
  24. bran.set(row[5])
  25. else:
  26. messagebox.showinfo("record not found")
  27. conn.close()
  28.  
  29. def bookdetails():
  30. rollnum = rnum.get()
  31. print(rollnum)
  32. conn = pymysql.connect(host='localhost', user='root', password='', db='data')
  33. b = conn.cursor()
  34. b.execute("select * from issuebook where rollno='" + rollnum + "'")
  35. resultb = b.fetchall()
  36. countb = b.rowcount
  37. print(resultb)
  38. print(countb)
  39. if countb > 0:
  40. for row in resultb:
  41. booknm.set(row[1])
  42. booknum.set(row[2])
  43. dateofiss.set(row[3])
  44. lstdate.set(row[4])
  45.  
  46. else:
  47. messagebox.showinfo("record not found")
  48. conn.close()
  49.  
  50. def details_and_bookdetails():
  51. details()
  52. bookdetails()
Add Comment
Please, Sign In to add comment