Menu.py. choice=int(input("enter Choice between 1 to > : "))

Similar documents
PYTHON MODULE :MENULIB

MySQL Guide. Meher Krishna Patel. Created on : Octorber, 2017 Last updated : December, More documents are freely available at PythonDSP

Databases in Python. MySQL, SQLite. Accessing persistent storage (Relational databases) from Python code

PROJECT ON HOTEL MANAGEMENT ABHA JAIN(PGT CS) KV BARWANI (BHOPLA REGION)

Project On Fee Management By: Sanjeev Bhadauria (PGT CS) KV BARABANKI (Lucknow Region)

Transactions for web developers

MySQL Connector/Python

Question Possible Points Earned Points Graded By GUI 22 SQL 24 XML 20 Multiple Choice 14 Total Points 80

LABORATORY OF DATA SCIENCE. Data Access: Relational Data Bases. Data Science and Business Informatics Degree

CSCI Design of Database Systems Spring 2018 Final Examination. Last Name: First Name: Student Id:

Introduction to: Computers & Programming: Exception Handling

ITEC 3335 Database Development Fall 2018 Final Examination. Last Name: First Name: Student Id:

PROJECT TITLE- SCHOOL MANAGEMENT

LABORATORY OF DATA SCIENCE. Data Access: Relational Data Bases. Data Science and Business Informatics Degree

MySQL Connector/Python Developer Guide

MariaDB ColumnStore PySpark API Usage Documentation. Release d1ab30. MariaDB Corporation

Error Code Called Name Not Present

Calling SQL from a host language (Java and Python) Kathleen Durant CS 3200

DATA MANAGEMENT FOR BUSINESS INTELLIGENCE

This document will tell you how to:

Chapter 6: Files and Exceptions. COSC 1436, Summer 2016 Dr. Ling Zhang 06/23/2016

Supplement: Case Study: Sudoku

1. What is the web address to the mail portal and what does the Sign in page look like?

CS 2316 Exam 4 Fall 2011

Chapter 5 : Informatics practices. Conditional & Looping Constructs. Class XI ( As per CBSE Board)

Web Interfaces for Database Servers

Red Hat Security Data API 1.0

Configuration Setting

9 APPLICATION DEVELOPMENT: SORT & SEARCH

Develop Python Applications with MySQL Connector/Python DEV5957

MGM s Jawaharlal Nehru Engineering College

05/11/2018 graph-stats.py 1 #!/usr/bin/env python

CE419 Web Programming. Session 15: Django Web Framework

Introduction to Microsoft Access

Python for Scientists

Read Naturally SE Update Windows Network Installation Instructions

WELCOME CSCA20 REVIEW SEMINAR

Chapter 6: Files and Exceptions. COSC 1436, Spring 2017 Hong Sun 3/6/2017

CSc 110, Autumn Lecture 11: if / else. Adapted from slides by Marty Stepp and Stuart Reges

Oracle SQL. murach s. and PL/SQL TRAINING & REFERENCE. (Chapter 2)

form which was sent by operations.

LOAd def. The display load defaults appears after choosing to load the default values for approx. 5 sec.

7. (2 pts) str( str( b ) ) str '4' will not compile (single, double, or triple quotes

CS 190 Exam 2 Fall 2014

Session Viewer. Tutorial

LECTURE 21. Database Interfaces

Resource Booker. User Guide. Log into Resource Booker. Make a Booking. Go to and click Log in.

The first step to getting your system set up is to update the General System Settings. These settings can be found by going to:

Microsoft SkyDrive Tutorial

Accessing E-Books using OverDrive

CS 1301 Exam 1 Spring 2014

MariaDB Crash Course. A Addison-Wesley. Ben Forta. Upper Saddle River, NJ Boston. Indianapolis. Singapore Mexico City. Cape Town Sydney.

API Wrapper Documentation

Instant HR Auditor Installation Guide

Introduction to programming using Python

Criterion D: Product design Overall structure

HOW TO FLASK. And a very short intro to web development and databases

Webgurukul Programming Language Course

AMP User Manual Tools Dropdown

To enable Managers to log in to Excellence and manage the i-plm training for their staff and themselves.

Quiz. Introduction: Python. In this project, you ll make a quiz game to challenge your friends. Activity Checklist.

smsghussd Documentation

Meeting Notifications for Cisco Unified MeetingPlace for Lotus Notes

CS 1301 Exam 1 Fall 2014

Blackboard Learn Self Instructional Documentation Series

Quick Reference 2007/7/6. Springer China Ltd st edition 12/06.

Recommended Maintenance Plan for Siriusware Clients for SQL server 2005

Lesson 18: Animation. Computer Programming is Fun!

ME30 Lab3 Decisions. February 20, 2019

Setting up GitHub Version Control with Qt Creator*

Structured Perceptron with Inexact Search

How to Create and Use a Skype Account

CSc 110, Spring Lecture 11: if / else. Adapted from slides by Marty Stepp and Stuart Reges

Part I. An Introduction to R

Web Traffic - pct of Page Views

MOTOR Data Management System Users Guide

Microsoft Access. Data may include facts about people, events, things, or ideas, and is an important asset to any organization.

BINF 6211 SQL. Lecture th, 2008 Dr. Jennifer W. Weller Dr. Andrew Carr. Instructors: Weller, Carr

Topic: Dropbox. Instructional Technology Services Dropbox Faculty Help. Dropbox Features: Minimum Requirements: Create a Dropbox Account

TREE RECURSION AND DATA ABSTRACTION

7 CREATING QUERY WITH QUERY WIZARD AND QUERY DESIGNER

ETD FAQ. Table of Contents

Friends of Horsey Seals. Seal Wardens Duty Rota. A guide to booking wardening duties online.

Syncrosoft License Control Release Notes

QVS-AVH-164D/3TB QUICK SETUP GUIDE

CS 1301 Exam 1 Fall 2010

Configuring PowerAlert SNMPWEBCARD for Use With Cisco EnergyWise

PLEAC-Python

Sql Server Syllabus. Overview

October/November 2009

Cisc320 Homework 3 Solutions. Question 1: Original. Insert 170. Insert 34. TA: Matt Saponaro

Programmers Guide. Adaptive Server Enterprise Extension Module for Python 15.7 SP100

Access Groups. Collect and Store. Text Currency Date/Time. Tables Fields Data Type. You Your Friend Your Parent. Unique information

Part 1 (80 points) Multiple Choice Questions (20 questions * 4 points per question = 80 points)

Threat Stack Python Client Documentation

CS 1301 Exam 1 Spring 2014

watson_ws_test June 5, 2017 In [1]: #test websocket connection to watson

ACCURATE STUDY GUIDES, HIGH PASSING RATE! Question & Answer. Dump Step. provides update free of charge in one year!

DGMS Booking User Manual

APPENDIX B - Python Scripts

Transcription:

Menu.py def MenuBook(): while True: SBook.clrscreen() print("\t\t\t SlamBook\n") print("=====================================================") print("1. Add Record ") print("2. Display Records ") print("3. Search Record ") print("4. Delete Record ") print("5. Update Record ") print("6. Return to Main Menu ") print("=====================================================") choice=int(input("enter Choice between 1 to 5-------> : ")) if choice==1: SBook.insertData() elif choice==2: SBook.display() elif choice==3: SBook.Searchfrnd() elif choice==4: SBook.deletedata() elif choice==5: print("no such Function") elif choice==6:

return print("wrong Choice...Enter Your Choice again") x=input("enter any key to continue") #----------------------------------------------------------------------------------------

Slam_Book.py import Menu import SBook while True: SBook.clrscreen() print("\t\t\t Slam Book Management\n") print("=====================================================") Menu.MenuBook() print("====================================================")

SBOOK.py import mysql.connector from mysql.connector import errorcode from datetime import date, datetime, timedelta from mysql.connector import (connection) import os import platform def clrscreen(): if platform.system()=="windows": print(os.system("cls")) def display(): try: os.system('cls') cnx = connection.mysqlconnection(user='root', password='mysql', host='localhost', database='slambook') Cursor = cnx.cursor() query = ("SELECT * FROM friends") Cursor.execute(query) for (id,name,addess,phno) in Cursor: print("--------------------------------------------------------------------") print("id : ",id) print("name : ",name) print("address : ",address)

print("phno : ",phno) print("------------------------------------------------------------") Cursor.close() print("completed!!!!!!") except mysql.connector.error as err: if err.errno == errorcode.er_access_denied_error: print("something is wrong with your user name or password") elif err.errno == errorcode.er_bad_db_error: print("database does not exist") print(err) def insertdata(): try: cnx = connection.mysqlconnection(user='root', password='mysql', host='127.0.0.1', database= slambook ) Cursor = cnx.cursor() id=input("enter id : ") name=input("enter Name : ") add=input("enter address : ") ph=int(input("enter phno : "))

"VALUES (%s, %s, %s, %s, %s, %s, %s)") data = (id,name,add,ph) Cursor.execute(Qry,data) Make sure data is committed to the database cnx.commit() Cursor.close() print("data saved successfully...") except mysql.connector.error as err: if err.errno == errorcode.er_access_denied_error: print("something is wrong with your user name or password") elif err.errno == errorcode.er_bad_db_error: print("database does not exist") print(err) def deletedata(): try: cnx = connection.mysqlconnection(user='root', password='mysql', host='127.0.0.1', database= slambook ) Cursor = cnx.cursor()

id=input("enter id of friend to be deleted : ") Qry =("""DELETE FROM Friends WHERE id = %s""") del_rec=(id,) Cursor.execute(Qry,del_rec) Make sure data is committed to the database cnx.commit() Cursor.close() print(cursor.rowcount,"record(s) Deleted Successfully...") except mysql.connector.error as err: if err.errno == errorcode.er_access_denied_error: print("something is wrong with your user name or password") elif err.errno == errorcode.er_bad_db_error: print("database does not exist") print(err) def Searchfrnd(): try: cnx = connection.mysqlconnection(user='root', password='mysql', host='127.0.0.1', database= slambook )

Cursor = cnx.cursor() id=input("enter id be Searched from the friends : ") query = ("SELECT * FROM Friends where id = %s ") rec_srch=(id,) Cursor.execute(query,rec_srch) Rec_count=0 for (Bno,Bname,Author,price,publ,qty,d_o_purchase) in Cursor: Rec_count+=1 for (id,name,addess,phno) in Cursor: print("--------------------------------------------------------------------") print("id : ",id) print("name : ",name) print("address : ",address) print("phno : ",phno) print("------------------------------------------------------------") if Rec_count%2==0: input("press any key to continue") clrscreen() print(rec_count, "Record(s) found") Make sure data is committed to the database cnx.commit() Cursor.close() except mysql.connector.error as err:

if err.errno == errorcode.er_access_denied_error: print("something is wrong with your user name or password") elif err.errno == errorcode.er_bad_db_error: print("database does not exist") print(err) def Updatefrnd(): try:

cnx = connection.mysqlconnection(user='root', password='mysql', host='127.0.0.1', database= slambook ) Cursor = cnx.cursor() id=input("enter id of frined to be Updated : ") query = ("SELECT * FROM Friends where id = %s ") rec_srch=(id,) print("enter new data ") name=input("enter new Name : ") add=input("enter address : ") ph=input("enter phno: ") Qry = ("UPDATE Friends SET name=%s,address=%s,"\ "phno=%s "\ "WHERE id=%s") data = (name,add,ph, bno) Cursor.execute(Qry,data) Make sure data is committed to the database''' cnx.commit() Cursor.close() print(cursor.rowcount,"record(s) Updated Successfully...") except mysql.connector.error as err:

if err.errno == errorcode.er_access_denied_error: print("something is wrong with your user name or password") elif err.errno == errorcode.er_bad_db_error: print("database does not exist") print(err) Updatefrnd()