2012年11月13日

sqlite3.OperationalError: Could not decode to UTF-8 column XXX with text '***'

摘要: 环境:python3.2 sqllite3代码如下:import sqlite3 as sqlconn = sql.connect(r'c:\setupinfidb.db', detect_types=sql.PARSE_COLNAMES)c = conn.cursor()c.execute('select * from setuplog')for row in c:print(row)运行以上代码时,提示:Traceback (most recent call last): File "sqlitetest.py", line x, in 阅读全文

posted @ 2012-11-13 17:19 FlowingCloud 阅读(1241) 评论(0) 推荐(0) 编辑

python访问数据库

摘要: python 访问数据库基本流程:1、建立连接 conn = xxx2、获取cursor c = conn.cursor()3、执行sql语句 c.execute()4、获取结果 c.fetchone() 或 c.fetchall() 返回单条数据或结果集 或 提交 conn.commit()5、关闭连接 conn.close() sqlite:1、使用 sqlite3:import sqlite3sqlserver:1、使用pywin32的odbc:import odbc2、使用pyodbc:import pyodbc3、使用pymssql:import pymssqlmysql:1、使.. 阅读全文

posted @ 2012-11-13 17:16 FlowingCloud 阅读(135) 评论(0) 推荐(0) 编辑

导航