标签:
1 #-*- coding:GBK -*- 2 3 4 import pymssql 5 print ‘Connect to the Datebase....‘ 6 7 conn = pymssql.connect(host=‘10.0.1.5‘ ,user=‘lc0049999‘ ,password = ‘‘,database=‘drp‘) 8 9 cur = conn.cursor() 10 if not cur: 11 raise(NameError,‘connect failed‘) 12 13 14 cur.execute(‘select * From lrkjqj‘) 15 16 row = cur.fetchone() 17 print row 18 while row: 19 print row[0],row[1] 20 row = cur.fetchone() 21 conn.close()
python 利用pymssql连接MSSQL数据库,简单示例
标签:
原文地址:http://www.cnblogs.com/lrzy/p/4346919.html