python代码不显示mysql数据库中的数据

时间:2018-03-12 06:53:21

标签: python mysql database phpmyadmin raspberry-pi

我创建了一个触摸屏按钮,包括“开始”“请求材料”“接收材料”“圈数”“紧急”“完成” 现在我试图将整数存储为成品数量(1,2,3等)和操作员按下单圈按钮时的单圈时间(类似于秒表)。基本上,只有两列。结果显示在我运行程序后终端没有错误,但它没有显示在mysql数据库中,我使用的是phpmyadmin。以下是我的代码:

public partial class VideoDevice
{
    public VideoDevice()
    {
        this.ImageApeSubscriptions = new HashSet<ImageApeSubscription>();
    }

    public int VideoDeviceID { get; set; }
    public Nullable<int> SiteId { get; set; }
    public string CompanyNumber { get; set; }
    public int SystemDeviceID { get; set; }
    public int CompanySystemID { get; set; }
    public string SystemDeviceName { get; set; }
    public string SystemDeviceTypeName { get; set; }
    public int NumCameras { get; set; }
    public string Provider { get; set; }
    public string DVRVersion { get; set; }
    public string IPAddress { get; set; }
    public string VPNIPAddress { get; set; }
    public string InternalUseIPAddress { get; set; }
    public Nullable<int> PrimaryCameraID { get; set; }
    public Nullable<System.DateTime> LastPingDate { get; set; }
    public string AudioTypeName { get; set; }
    public string ViewerClassName { get; set; }
    public string ViewerName { get; set; }
    public string OverrideIP { get; set; }

    public virtual ICollection<ImageApeSubscription> ImageApeSubscriptions { get; set; }
}

请分享 谢谢 顺便说一句,我正在使用覆盆子pi与raspbian拉伸

1 个答案:

答案 0 :(得分:0)

提交所需的每个跨国(插入,更新和删除)查询比反映数据库引擎之后。因此,请在执行查询后尝试使用autocommit(True)或提交手册。

 self.db = MySQLdb.connect("localhost","root","raspberry","DB_ASSY")
 self.sql = "INSERT INTO Table_Assembly (Finished Product, Lap Time) VALUES (%s, %s)"
 self.c= self.db.cursor()
 self.db.commit()