no mistake but i didnt get what i want (with python module pymssqlsend information to the mssql)

G

gdyren

the code is below:
import pymssql
conn = pymssql.connect(host = "121.198.126.233",user = "xxxx",password
= "xxxx",database = "test")
print "connecting success"
cursor = conn.cursor()
cursor.execute("insert into bbs_test values(%s,%s,%s,%s,%s)",
("1","nju","9:13","ustc","test"))
cursor.close()
conn.close()
in the idle:
connecting success

then i get into the database :test and find that there is nothing in
the table bbs_test.
i don't know why
 
P

Peter Otten

the code is below:
import pymssql
conn = pymssql.connect(host = "121.198.126.233",user = "xxxx",password
= "xxxx",database = "test")
print "connecting success"
cursor = conn.cursor()
cursor.execute("insert into bbs_test values(%s,%s,%s,%s,%s)",
("1","nju","9:13","ustc","test"))
cursor.close()
conn.close()
in the idle:
connecting success

then i get into the database :test and find that there is nothing in
the table bbs_test.
i don't know why

Because you did not commit your changes with conn.commit().

Peter
 
G

gdyren

Because you did not commit your changes with conn.commit().

Peter- Òþ²Ø±»ÒýÓÃÎÄ×Ö -

- ÏÔʾÒýÓõÄÎÄ×Ö -

thank you . I know how .
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top