0
Integrate sql with python by importing the mysql module to search an employee using using empno and if present in the table
(question cont..) display the record , if not present display appropriate message
4 Réponses
0
What is empno?
0
Empno is a column name in MySQL table
0
First pip install pyodbc
I reccomend you mysql odbc 8.0 Unicode Driver 32 and 64bit
Then in your python code:
import pyodbc
from tkinter import messagebox
cn=pyodbc.connect{...} = connect to your server, userid,password etc.
cursor=cn.cursor()
sql="Select empco from employee where..."
# where you can specify your conditon
Then next in code:
cursor.execute(sql)
rowDB = cursor.fetchone()
if rowDB is None:
messeagebox.showerror('Error')
0
Bhej chod