Exemple #1
0
def deletestockbutton():
    global p,conn,cursor,sto,d,ent7
    try:
        db = read_db_config()
        conn = MySQLConnection(**db)
        cursor = conn.cursor()
        qry = "delete from grocery where Item_Name=%s"
        args = (ent7.get(),)
        cursor.execute(qry, args)
        conn.commit()
        displayren()
    except Error as e:
        print(e)
Exemple #2
0
def dbreg():
        try:
            db = read_db_config()
            conn = MySQLConnection(**db)
            print("connected succesfull with my data base")
            cursor = conn.cursor()
            qry = "insert into tbreg(regpwd,regnm)values(%s,%s)"
            args = ( ent2.get(), ent1.get())
            cursor.execute(qry, args)
            conn.commit()
        except Error as e:
            print(e)
        finally:
            cursor.close()
            conn.close()
        root.destroy()
Exemple #3
0
def dblog():
    try:
        db = read_db_config()
        conn = MySQLConnection(**db)
        cursor = conn.cursor()
        qry = "select*from tbreg where regnm=%s and regpwd=%s"
        args = (ent1.get(), ent2.get())
        cursor.execute(qry, args)
        rows = cursor.fetchall()
        if cursor.rowcount == 0:
            lblres.configure(text="login failed")
        else:
            lblres.configure(text="login successfull")
            open_win()
    except Error as e:
        print(e)
    finally:
        cursor.close()
        conn.close()
Exemple #4
0
def chk(): #checks if the medicine is already present so that can be modified
    global cursor, conn, value, sto,columns
    try:
        db = read_db_config()
        conn = MySQLConnection(**db)
        cursor = conn.cursor()
        #cursor.execute("select * from grocery")
        qry = "insert into grocery( Item_Name, Item_Type, Quantity_Remain, Item_Cost, Expiry_Date,Manufactured_By)values(%s,%s,%s,%s,%s,%s)"
        args=( ent1.get(),ent2.get(),ent3.get(), ent4.get(),ent5.get(), ent6.get())
        #qry = "insert into grocery values('%s','%s','%s','%s','%s','%s','%s')" % (y, x[1], x[2], x[3], x[4], x[5], x[6])
        cursor.execute(qry,args)
        conn.commit()
    except Error as e:
        print(e)
    finally:
        cursor.execute("select * from grocery")
    #print(z)

    top=Tk()
    Label(top,width=20, text='Success!').pack()
    top.mainloop()
Exemple #5
0
from Tkinter import *
from configuration import read_db_config
from mysql.connector import MySQLConnection,Error

WinStat =''
db = read_db_config()
conn = MySQLConnection(**db)
cursor = conn.cursor()


def stock():
    application.destroy()
    conn.close()
    import stockdetails
    a = stockdetails.stock()
    open_win()


def delstock():
    application.destroy()
    # login=sqlite.connect("grocery.sqlite")
    # l=login.cursor()
    conn.close()

    import stockdetails
    a = stockdetails.deletestock()

    open_win()