写了个小工具,其中涉及到从远程数据库中查询并返回,数据库是utf8编码,但是我的工具用的是GB2312编码,因此在返回数据的时候,有部分数据出现了:Truncated incorrect DECIMAL value 的警告信息. 但是并不妨碍工具获取查询结果和后续操作,只是每次运行,都会出现几行告警信息,实在很难看.在网上查了一下,发现,如果是通过命令提示符运行.py文件,可以忽略告警.例如我的代码文件是"test.py",则可在命令提示符中输入: python -W ignore t
原文:.Net中获取打印机的相关信息 新项目中牵涉到对打印机的一些操作,最重要的莫过于获取打印机的状态,IP等信息,代码量不大,但是也是自己花了一点时间总结出来的,希望能帮助需要的朋友. PrinterCommunicate用于连接打印机并发送指令 1 public class PrinterCommunicate { public bool CheckNetWorkConnection(string strPrinterIP, int intPrinterPort) { System.Net.
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Net; using System.Management; //在项目->添加引用....里面引用System.Management using System.Runtime.InteropServices; namespace FileSp