美文网首页初见
19、python操作 SQLSERVER数据库和有关HTML

19、python操作 SQLSERVER数据库和有关HTML

作者: 梦捷者 | 来源:发表于2020-04-20 10:40 被阅读0次

    python操作 SQLSERVER数据库基础教程

    import pymssql
    import pandas as pd
    
    
    sql = "select TOP 50 * from [dbo].[AM4313000001] ORDER  BY  1 DESC"
    conn = pymssql.connect(server='134.175.74.32', user='sa', password='JDDBM999@', database='Power4313000003')
    cursor = conn.cursor()
    sql2 = "insert into [dbo].[AM4313000001] VALUES ('2020-04-15 11:19:08','231.463','231.463','231.463','655.35','655.35','655.35','655.35','655.35','655.35','0.1','0.2','71335.7','71335.7','71335.7','71335.7','71335.7','71335.7','71335.7','71335.7','71335.7','71335.7','925.959','925.959','925.959','925.959','925.959','925.959','50.959','925.959','-1.959','925.959','0','925.959','0')"
    cursor.execute(sql2)
    
    df0 = pd.read_sql(sql, conn)
    conn.commit()
    conn.close()
    df1 = pd.DataFrame(df0)
    print(df0)
    

    HTML img图片加载失败时用默认图片替换

    参考文档:https://blog.csdn.net/tanga842428/article/details/76763693

    相关文章

      网友评论

        本文标题:19、python操作 SQLSERVER数据库和有关HTML

        本文链接:https://www.haomeiwen.com/subject/ucaqvhtx.html