文章内容

2017/8/21 13:36:25,作 者: 黄兵

使用python 连接Microsoft Sql Server

使用python 连接数据库代码如下:

#conn = pyodbc.connect(r'DRIVER={SQL Server Native Client 10.0};SERVER=111.111.111.111,1444;DATABASE=111111.com;UID=ba;PWD=111111')
#cursor = conn.cursor
#cursor.execute("INSERT INTO Articles (Title, CreateTime,Reader,ArticleBody,Category_Id,SEOId,AuthorId,Topic,ImgUrl,News,FirstProject,SecondProject)VALUES (\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\")",
# (title,datetime.now(),0,context,'',6,1,0,'',0,0,0))
#cursor.execute("insert into Articles(Title, CreateTime,Reader,ArticleBody,Category_Id,SEOId,AuthorId,Topic,ImgUrl,News,FirstProject,SecondProject) values (title,datetime.now(),0,context,,6,1,0,,0,0,0 )")
#conn.commit()

黄兵的个人博客原创。

转载请注明出处:使用python 连接Microsoft Sql Server

分享到:

发表评论

评论列表