<bdo id='H8DQQ'></bdo><ul id='H8DQQ'></ul>
    <legend id='H8DQQ'><style id='H8DQQ'><dir id='H8DQQ'><q id='H8DQQ'></q></dir></style></legend>
    1. <i id='H8DQQ'><tr id='H8DQQ'><dt id='H8DQQ'><q id='H8DQQ'><span id='H8DQQ'><b id='H8DQQ'><form id='H8DQQ'><ins id='H8DQQ'></ins><ul id='H8DQQ'></ul><sub id='H8DQQ'></sub></form><legend id='H8DQQ'></legend><bdo id='H8DQQ'><pre id='H8DQQ'><center id='H8DQQ'></center></pre></bdo></b><th id='H8DQQ'></th></span></q></dt></tr></i><div id='H8DQQ'><tfoot id='H8DQQ'></tfoot><dl id='H8DQQ'><fieldset id='H8DQQ'></fieldset></dl></div>
    2. <small id='H8DQQ'></small><noframes id='H8DQQ'>

      <tfoot id='H8DQQ'></tfoot>

        Python MySql 插入不起作用

        时间:2023-06-01
        <i id='nx4Hp'><tr id='nx4Hp'><dt id='nx4Hp'><q id='nx4Hp'><span id='nx4Hp'><b id='nx4Hp'><form id='nx4Hp'><ins id='nx4Hp'></ins><ul id='nx4Hp'></ul><sub id='nx4Hp'></sub></form><legend id='nx4Hp'></legend><bdo id='nx4Hp'><pre id='nx4Hp'><center id='nx4Hp'></center></pre></bdo></b><th id='nx4Hp'></th></span></q></dt></tr></i><div id='nx4Hp'><tfoot id='nx4Hp'></tfoot><dl id='nx4Hp'><fieldset id='nx4Hp'></fieldset></dl></div>
        • <small id='nx4Hp'></small><noframes id='nx4Hp'>

            <bdo id='nx4Hp'></bdo><ul id='nx4Hp'></ul>
            <tfoot id='nx4Hp'></tfoot>

                <legend id='nx4Hp'><style id='nx4Hp'><dir id='nx4Hp'><q id='nx4Hp'></q></dir></style></legend>

                  <tbody id='nx4Hp'></tbody>

                  本文介绍了Python MySql 插入不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在使用 python MySQL API 从 python 程序连接到 Mysql 数据库.我从几天就面临一个问题.我无法将记录插入数据库,不知道是什么原因.这是我连接并将记录插入数据库的方式.

                  I am using python MySQL API to connect to Mysql database from python program. I am facing a problem from few days. I am unable to insert records into the database and dont know whats the reason. Here is the way i connect and insert records into the database.

                  db = MySQLdb.connect("localhost","root","padmaramulu","pdfsearch" )
                  cursor = db.cursor()
                  #cursor.execute("""CREATE TABLE IF NOT EXISTS documents (docid INT NOT NULL ,PRIMARY KEY(docid),docname CHAR(30)) engine=innodb""")
                  temp = "hello";number = 2;
                  cursor.execute( 'insert into documents(docid,docname) values("%d","%s")' % (number,temp) )
                  db.close()
                  

                  为什么会这样?

                  推荐答案

                  在关闭连接之前,你应该添加db.commit().

                  Before closing the connection, you should add db.commit().

                  这篇关于Python MySql 插入不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:将 RMySQL 包添加到 R 失败(在 Windows 上)? 下一篇:WHERE 子句中的条件顺序是否会影响 MySQL 性能?

                  相关文章

                  1. <small id='TeIdS'></small><noframes id='TeIdS'>

                    <legend id='TeIdS'><style id='TeIdS'><dir id='TeIdS'><q id='TeIdS'></q></dir></style></legend>

                      • <bdo id='TeIdS'></bdo><ul id='TeIdS'></ul>

                      <tfoot id='TeIdS'></tfoot>
                    1. <i id='TeIdS'><tr id='TeIdS'><dt id='TeIdS'><q id='TeIdS'><span id='TeIdS'><b id='TeIdS'><form id='TeIdS'><ins id='TeIdS'></ins><ul id='TeIdS'></ul><sub id='TeIdS'></sub></form><legend id='TeIdS'></legend><bdo id='TeIdS'><pre id='TeIdS'><center id='TeIdS'></center></pre></bdo></b><th id='TeIdS'></th></span></q></dt></tr></i><div id='TeIdS'><tfoot id='TeIdS'></tfoot><dl id='TeIdS'><fieldset id='TeIdS'></fieldset></dl></div>