国产成人精品久久免费动漫-国产成人精品天堂-国产成人精品区在线观看-国产成人精品日本-a级毛片无码免费真人-a级毛片毛片免费观看久潮喷

您的位置:首頁技術文章
文章詳情頁

python數據庫編程 ODBC方式實現通訊錄

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

Python 數據庫編程,ODBC方式實現通訊錄,供大家參考,具體內容如下

#-*-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()

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持好吧啦網。

標簽: Python 編程
相關文章:
主站蜘蛛池模板: 免费观看国产网址你懂的 | 欧美一级欧美三级在线 | 国产成人免费不卡在线观看 | 亚洲高清在线看 | 国产一区二区三区免费看 | 国产一级做a爱片久久毛片a | 久久久一区二区三区 | 中文字幕天堂久久精品 | 精品无人区一区二区三区a 精品午夜国产在线观看不卡 | 欧美一区二区三区视频在线观看 | 美女被男人桶到嗷嗷叫爽网站 | www中文字幕 | 欧美韩国日本一区 | 国产精品极品美女自在线看免费一区二区 | 亚洲国产人成中文幕一级二级 | 手机av在线播放 | 亚洲精品成人一区 | 131的美女午夜爱爱爽爽视频 | 精品视频在线免费看 | 国产精品亚洲精品不卡 | 亚州免费 | 日韩免费一级毛片欧美一级日韩片 | 国产精品免费一区二区三区四区 | 国产激情自拍 | 日韩美女在线视频 | 精品国产乱码久久久久久一区二区 | 久久久国产一区二区三区丝袜 | 亚洲成a人片在线观看精品 亚洲成a人片在线观看中 | 女人成午夜大片7777在线 | 国产亚洲综合成人91精品 | 欧美成人精品高清在线观看 | 国产国产成人精品久久 | 久热国产在线视频 | 狠狠色丁香婷婷综合小时婷婷 | 日韩美a一级毛片 | 国产精品久久久久久久久久久不卡 | 欧美一区二区三区精品国产 | 国产亚洲91 | 日本亚洲视频 | 私人玩物福利视频 | 精品欧美一区二区在线观看 |