#!/usr/bin/env python
# encoding: utf-8
"""
@author: Frank
@file: sqlserver.py
@time: 2017/5/22
"""
import pyodbc
import pandas as pd
conn = pyodbc.connect('DRIVER={SQL Server};SERVER=2001:da8:700e:e00:d129:18c:5345:5a44;DATABASE=zc_nxjc_znc_znf_dcs02;UID=sa;PWD=123456')
#cur = conn.cursor()
#cur.execute("select top 3 * from dbo.DCSContrast")
#resList = cur.fetchall()#fetchall()是接收全部的返回结果行
#if not cur:
# raise (NameError,"数据库连接失败")
#df = pd.DataFrame(resList)
df = pd.read_sql("select * from dbo.DCSContrast",con=conn)
df1=pd.read_sql("select * from History_ProcessVariable01",con=conn)
conn.close()
print(df1)
# encoding: utf-8
"""
@author: Frank
@file: sqlserver.py
@time: 2017/5/22
"""
import pyodbc
import pandas as pd
conn = pyodbc.connect('DRIVER={SQL Server};SERVER=2001:da8:700e:e00:d129:18c:5345:5a44;DATABASE=zc_nxjc_znc_znf_dcs02;UID=sa;PWD=123456')
#cur = conn.cursor()
#cur.execute("select top 3 * from dbo.DCSContrast")
#resList = cur.fetchall()#fetchall()是接收全部的返回结果行
#if not cur:
# raise (NameError,"数据库连接失败")
#df = pd.DataFrame(resList)
df = pd.read_sql("select * from dbo.DCSContrast",con=conn)
df1=pd.read_sql("select * from History_ProcessVariable01",con=conn)
conn.close()
print(df1)