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

10th Dec 2020, 3:50 PM
Kinsukh S Sonbawne
Kinsukh S Sonbawne - avatar
4 Réponses
0
What is empno?
11th Dec 2020, 7:01 PM
Václav Dostál
Václav Dostál - avatar
0
Empno is a column name in MySQL table
12th Dec 2020, 4:17 AM
Kinsukh S Sonbawne
Kinsukh S Sonbawne - avatar
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')
12th Dec 2020, 10:41 AM
Václav Dostál
Václav Dostál - avatar
0
Bhej chod
20th Jan 2023, 11:19 AM
Ranveer singh Gautam
Ranveer singh Gautam - avatar