473,320 Members | 1,957 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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

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
Oct 17 '08 #1
4 1270
gd****@gmail.com wrote:
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
Oct 17 '08 #2
On 10月17日, 下午6时41分, Peter Otten <__pete...@web.dewrote:
gdy...@gmail.com wrote:
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- 隐藏被引用文字 -

- 显示引用的文字 -
???how to.
Oct 17 '08 #3
On 10月17日, 下午6时41分, Peter Otten <__pete...@web.dewrote:
gdy...@gmail.com wrote:
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- 隐藏被引用文字 -

- 显示引用的文字 -
thank you . I know how .
Oct 17 '08 #4
gd****@gmail.com wrote:
On 10鏈17鏃, 涓嬪崍6鏃41鍒, Peter Otten <__pete...@web.dewrote:
>gdy...@gmail.com wrote:
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.commit() # This makes the inserted record permanent
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().
???how to.
Call conn.commit() before conn.close() like shown above.

Peter
Oct 17 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

54
by: Brandon J. Van Every | last post by:
I'm realizing I didn't frame my question well. What's ***TOTALLY COMPELLING*** about Ruby over Python? What makes you jump up in your chair and scream "Wow! Ruby has *that*? That is SO...
7
by: Michele Simionato | last post by:
So far, I have not installed Prothon, nor I have experience with Io, Self or other prototype-based languages. Still, from the discussion on the mailing list, I have got the strong impression that...
92
by: Reed L. O'Brien | last post by:
I see rotor was removed for 2.4 and the docs say use an AES module provided separately... Is there a standard module that works alike or an AES module that works alike but with better encryption?...
10
by: ross | last post by:
I want to do some tricky text file manipulation on many files, but have only a little programming knowledge. What are the ideal languages for the following examples? 1. Starting from a certain...
15
by: Rob Nicholson | last post by:
I'm starting to worry a bit now. We're getting the above error when two users hit the same database/page on an ASP.NET application using ADO.NET, talking to a SQL 7 server. The error is perfectly...
9
by: arvind | last post by:
Hi all, I am going to work on Python 2.4.3 and MSSQL database server on Windows platform. But I don't know how to make the connectivity or rather which module to import. I searched for the...
10
by: Dale Strickland-Clark | last post by:
Python 2.4.2 (#1, Oct 13 2006, 17:11:24) on linux2 Type "help", "copyright", "credits" or "license" for more information. <object object at 0xb7bbd438> Traceback (most recent call last): File...
1
by: Clarence | last post by:
It appears that the -W option on starting python doesn't work the same as the warnings module. In particular, the "message" parameter is not treated as a regular expression, but rather a string...
6
by: dudeja.rajat | last post by:
Hi, I found on the net that there is something called module initialization. Unfortunately, there is not much information for this. However, small the information I found module initialization...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you抣l learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Sh鎙l頿魀 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.