PythonÁ¬½ÓSqlServerÁ·Ï°¼Ç¼
import pymssql
#connect database
conn=pymssql.connect(host="192.168.1.28",user="boomink",password="boomink",
database="boomink")
cur=conn.cursor()
print '========================================'
cur.execute("exec Orders_GetTest1 @Value=%s ",('2005-01-01',))
while 1:
print cur.fetchall()
if 0 == cur.nextset():
break
data=cur.fetchall()
print data
print '========================================'
#cur.execute("exec Orders_GetTest")
cur.execute("exec Orders_GetTest2 @Value1=%s,@Value2=%s",('Ruan','Yu'))
while 1:
print cur.fetchall()
if 0 == cur.nextset():
break
data=cur.fetchall()
print data
print '========================================'
cur.execute("exec Orders_GetTracking @BeginDate=%s,@EndDate=%s",('2005-01-01','2008-01-01'))
record = cur.fetchall()
while 1:
print cur.nextset()
for r in record:
print '========================================'
a=r[1]
print 'OrderId:%s' % r[0]
print r
print '========================================'
if 0 == cur.nextset():
break
print "rnrow count:%d" % cur.rowcount
#commit the connection
conn.commit
#close the connection
conn.close
Ïà¹ØÎĵµ£º
×÷Õߣºtaowen, billrice
http://www.cnblogs.com/taowen/articles/11239.html
Lesson 1 ×¼±¸ºÃѧϰPythonµÄ»·¾³
ÏÂÔصĵØÖ·ÊÇ£º
www.python.org
ΪÁË´ó¼ÒµÄ·½±ã£¬ÎÒÔÚУÄÚ×÷ÁËcopy£º
http://10.1.204.2/tool/compiler&IDE/Python-2.3.2-1.exe
linux°æ±¾µÄÎҾͲ»ËµÁË£¬ÒòΪÈç¹ûÄãÄܹ»Ê¹ÓÃlinux²¢°²×°ºÃ˵Ã÷Äã¿ÉÒÔ ......
×î½üÒªÓõ½´®¿ÚͨѶ£¬¼òµ¥Ò×ÓõÄPythonÓÖ°ïÉÏæÁË£¬¶à¿÷ÁËÅÓ´óµÄµÚÈý·½×ÊÔ´~~~ £º£©
pySerial
Overview
This module encapsulates the access for the serial port. It provides
backends for Python running on Windows, Linux, BSD (possibly any POSIX
compliant system), Jython and IronPython (.NET and M ......
ÈçÓÐһ·¾¶"e:/software/²âÊÔ.txt"
ÐèҪͨ¹ýpyhon¶Á/д "²âÊÔ.txt"Îļþ£¬¿ÉÒÔ²ÉÓÃÏÂÃæµÄ·½·¨£º
ipath = "e:/software/²âÊÔ.txt"
uipath = unicode(ipath , "utf8")
È»ºóÓÃ"uipath"¾¹ý±àÂëºóµÄ·¾¶È¥open()¼´¿É¡£
ÏÂÃæÊÇÎÒÔÚÏîÄ¿ÖÐÓÃpython¶ÁдexcelµÄÒ»µãÌå»á(½â¾öÁ˶ÁÖÐÎÄÎļþà ......
ÈçºÎÔÚSqlserverÖдÓÍⲿXMLÎļþÖжÁÈ¡ÅäÖÃÐÅÏ¢ÄØ£¿¸ÃÎÊÌâÔ´×ÔÒ»¼ÒÆóÒµµÄ±ÊÊÔÐÅÏ¢ÓиС£
Ò»xmlÎļþÄÚÈÝ£º
<?xml version="1.0" encoding="utf-8"?>
<root>
<db name="ClientDB1" datasize="512MB" datagrowth="100MB" logsize="100MB" loggrowth ="50MB">
</db>
<db ......
>>> class objA:
... pass
...
>>> A = objA()
>>> B = 'a','V'
>>> B
('a', 'V')
>>> C = 'a string'
>>> print instance(A,objA)
Traceback (most recent call last):
File "<stdin>", line 1, in < ......