473,804 Members | 3,855 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.23 3",user = "xxxx",pass word
= "xxxx",data base = "test")
print "connecting success"
cursor = conn.cursor()
cursor.execute( "insert into bbs_test values(%s,%s,%s ,%s,%s)",
("1","nju","9:1 3","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 1295
gd****@gmail.co m wrote:
the code is below:
import pymssql
conn = pymssql.connect (host = "121.198.126.23 3",user = "xxxx",pass word
= "xxxx",data base = "test")
print "connecting success"
cursor = conn.cursor()
cursor.execute( "insert into bbs_test values(%s,%s,%s ,%s,%s)",
("1","nju","9:1 3","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.co m wrote:
the code is below:
import pymssql
conn = pymssql.connect (host = "121.198.126.23 3",user = "xxxx",pass word
= "xxxx",data base = "test")
print "connecting success"
cursor = conn.cursor()
cursor.execute( "insert into bbs_test values(%s,%s,%s ,%s,%s)",
("1","nju","9:1 3","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.co m wrote:
the code is below:
import pymssql
conn = pymssql.connect (host = "121.198.126.23 3",user = "xxxx",pass word
= "xxxx",data base = "test")
print "connecting success"
cursor = conn.cursor()
cursor.execute( "insert into bbs_test values(%s,%s,%s ,%s,%s)",
("1","nju","9:1 3","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.co m wrote:
On 10鏈17鏃, 涓嬪崍6鏃41鍒 , Peter Otten <__pete...@web. dewrote:
>gdy...@gmail.c om wrote:
the code is below:
import pymssql
conn = pymssql.connect (host = "121.198.126.23 3",user = "xxxx",pass word
= "xxxx",data base = "test")
print "connecting success"
cursor = conn.cursor()
cursor.execute( "insert into bbs_test values(%s,%s,%s ,%s,%s)",
("1","nju","9:1 3","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
6585
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 FRICKIN' COOL!!! ***MAN*** that would save me a buttload of work and make my life sooooo much easier!" As opposed to minor differences of this feature here, that feature there. Variations on style are of no interest to me. I'm coming at this from a...
7
3564
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 you do not actually need to fork Python in order to implement prototypes. It seems to me that Python metaclasses + descriptors are more than powerful enough to implementing prototypes in pure Python. I wrote a module that implements part of what...
92
6549
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? cheers, reed
10
3728
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 folder, look in the subfolders for all filenames matching *FOOD*.txt Any files matching in each folder should be copied to a new subfolder within the current folder called EATING with a new name of *FOOD*COPY.txt
15
8291
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 repeatable :-( But this should help! The error is occurring inside ExecuteReader which uses a DataReader internally. Here are some things that I'm pretty sure it's *NOT*:
9
1930
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 modules in the Python library, but I couldn't find which module to go for. Please help me out!
10
1166
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 "<stdin>", line 1, in ? AttributeError: 'object' object has no attribute 'spam' .... pass .... <__main__.b object at 0xb7b4dcac>
1
1538
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 literal which must appear at the beginning of a warning message in order to match. The treatment of -W in "python -h" makes no mention of the warnings module (and I actually couldn't find any definitive documentation on command line switches),...
6
2277
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 can be of use to me in my project. I'm currently messing with a problem where I'm keeping my global variables ( or symbols) in a module and the other mdoules in the project acess these global variables.
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we抣l explore What is ONU, What Is Router, ONU & Router抯 main usage, and What is the difference between ONU and Router. Let抯 take a closer look ! Part I. Meaning of...
0
9577
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10569
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10325
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10315
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10075
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9140
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project梡lanning, coding, testing, and deployment梬ithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7615
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.