Exemplo n.º 1
0
def delete(): # using the same just changing querry and messagebox info
    try:
        con = pymsql.connect(user='******', password='', host='localhost', database='db')
        cur = con.cursor()
        sql = "delete from student where Rollno = '%s'" %(Rollno.get())
        cur.execute(sql)
        con.commit()
        con.close()
        messagebox.showinfo('Success','Rrcord deleted...')
    except:
        messagebox.showinfo('Error','Error occured...')
Exemplo n.º 2
0
def add():  # using the same just changing querry and messagebox info
    try:
        con = pymsql.connect(user='******', password='', host='localhost', database='db')
        cur = con.cursor()
        sql = "insert into student values('%s','%s','%s')" %(Rollno.get(),name.get(),age.get())
        cur.execute(sql)
        con.commit()
        con.close()
        messagebox.showinfo('Success','Rrcord saved...')
    except:
        messagebox.showinfo('Error','Error in data entry...')
Exemplo n.º 3
0
def search():
    try:
        con = pymsql.connect(user='******', password='', host='localhost', database='db')  #connection
        cur = con.cursor()    #same
        sql = "select * from student where Rollno='%s'"%Rollno.get()   #querry tht should be performed
        cur.execute(sql)     #execution
        result = cur.fetchone()   #getting one value
        name.set(result[1])
        age.set(result[2])
        e1.configure(state = 'disabled')
        con.close()
    except:
        messagebox.showinfo('No Data','No such data available')
        clear()
Exemplo n.º 4
0
def Mysql(host, port, user, passwd, db, charset='utf-8'):
    conn = pymsql.connect(host=host,
                          port=port,
                          user=user,
                          passwd=passwd,
                          db=db,
                          charset=charset)
    cursor = conn.cursor()
    try:
        yield cursor
    finally:
        conn.commit()
        cursor.close()
        conn.close()
Exemplo n.º 5
0
# Programm to calculate the FIS base-List with the old (2020), non Covid Calculation Rules
# Author: Stefan Rammer - Ski Austria Technology
# Mail: [email protected]

import pymsql
import time

from Classes.DbHandler import DbHandler

db_source = pymsql.connect("localhost", "root", "supertrixi22!",
                           "karriere_analyse_2021")
source = DbHandler(db_source)

source.getVersion()