我使用python-2.7和newbie到mysql/mysql-python连接器.
我只是想通过以下查询来检索数据 -
SELECT d_id,d_link,d_name FROM d_details
但它给出/返回 无.以下是我的代码 -
def getdbconnection(self): try: self.cnx = mysql.connector.connect(user='abc',password='xxx',host = 'localhost',port = 'xxx', database='details',buffered=True) print "Done" self.cursor = self.cnx.cursor() except MySQLdb.Error as error: print "ERROR IN CONNECTION" def selectst(self): try: print "S E L E C T" self.d_deta = self.cursor.execute("SELECT d_id,d_link,d_name FROM `d_details`") print self.d_deta except MySQLdb.Error as error: print "---------------------""" print(error) self.cnx.commit()
和输出是
Done S E L E C T None
虽然查询在工作台中运行良好
欢迎任何形式的帮助/指导.