久久福利_99r_国产日韩在线视频_直接看av的网站_中文欧美日韩_久久一

您的位置:首頁技術(shù)文章
文章詳情頁

python數(shù)據(jù)庫編程 ODBC方式實(shí)現(xiàn)通訊錄

瀏覽:3日期:2022-08-01 08:54:19

Python 數(shù)據(jù)庫編程,ODBC方式實(shí)現(xiàn)通訊錄,供大家參考,具體內(nèi)容如下

#-*-coding:utf-8-*-import pyodbcimport osdef SelectInfo(hcon,hcur): hcur.execute(’select * from PassMapT’) ptitle=(’ID’,’Item’,’Pwd’,’other’) print(ptitle) result=hcur.fetchall() for item in result: print(item) print(’’)def AddInfo(hcon,hcur): id=int(input(’please input ID: ’)) item=str(input(’please input Item: ’)) pwd=str(input(’please input Tel 1: ’)) other=str(input(’please input Other: ’)) sql='insert into PassMapT(id,item,pwd,other) values(?,?,?,?)' try: hcur.execute(sql,(id,item,pwd,other)) hcon.commit() except: hcon.rollback()def DeleteInfo(hcon,hcur): SelectInfo(hcon,hcur) did=int(input(’please input id of delete: ’)) sql='delete from PassMapT where id=?' try: hcur.execute(sql,(did,)) hcon.commit() except: hcon.rollback()def UpdateInfo(hcon,hcur): SelectInfo(hcon,hcur) did=int(input(’please input id of update: ’)) sqlitem='update PassMapT set item=? where id=?' item=str(input(’please input Item: ’)) try: hcur.execute(sqlitem,(item,did)) hcon.commit() except: hcon.rollback() sqlpwd='update PassMapT set pwd=? where id=?' pwd=str(input(’please input Pwd: ’)) try: hcur.execute(sqlpwd,(pwd,did)) hcon.commit() except: hcon.rollback() sqlother='update PassMapT set other=? where id=?' other=str(input(’please input other: ’)) try: hcur.execute(sqlother,(other,did)) hcon.commit() except: hcon.rollback() def Meau(): print(’1.diaplay’) print(’2.add’) print(’3.update’) print(’4.delete’) print(’5.cls’) print(’0.exit’) sel=9 while(sel>5 or sel<0): sel=int(input(’please choice: ’)) return seldef main(): hcon = pyodbc.connect(r’DRIVER={SQL Server Native Client 11.0};SERVER=127.0.0.1;DATABASE=PasswordMap;UID=sa;PWD=lptpwd’) hcur=hcon.cursor() while(True): sel=Meau() if(sel==1): SelectInfo(hcon,hcur) elif(sel==2): AddInfo(hcon,hcur) elif(sel==3): UpdateInfo(hcon,hcur) elif(sel==4): DeleteInfo(hcon,hcur) elif(sel==5): os.system(’cls’) else: break hcur.close() hcon.close()if __name__==’__main__’: main()

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持好吧啦網(wǎng)。

標(biāo)簽: Python 編程
相關(guān)文章:
主站蜘蛛池模板: 久久成人国产视频 | 日韩一区二区三区福利视频 | 国产999免费视频 | 91精品欧美久久久久久动漫 | 成人免费crm一区二区 | 中文字幕一区二区三区精彩视频 | 操到爽| 精品一区二区三区在线观看 | 91视频黄色| 成人黄页在线观看 | 中文字幕一区二区三区乱码在线 | 国产一区二区三区四区 | 亚洲一区精品在线 | 国内成人免费视频 | 亚洲欧美日韩在线 | 亚洲黄色免费观看 | 精品一区二区三区免费毛片 | 中文字幕在线日韩 | 成人国产精品视频 | 日韩拍拍 | 亚洲国产中文字幕 | 国产中文视频 | 国产精品久久久久久久9999 | 狠狠亚洲| 在线视频成人 | 国产精品45p| 久久国产精品久久久久久电车 | 33eee在线视频免费观看 | 国产网站在线播放 | 欧美极品一区二区 | 国内精品一区二区三区 | 日韩城人免费 | 欧美视频在线一区 | 久久久精品网站 | 国产一区二区三区免费视频 | 欧美精品理论片大全 | 亚洲a网| 中文字幕一区二区三区不卡 | 日韩在线视频一区 | 亚洲精品乱码久久观看网 | 欧美日韩视频第一页 |