private void test_Load(object sender, EventArgs e) { common cmn = new common(); using (MySqlConnection conn = new MySqlConnection(cmn.strcon)) { conn.Open(); MySqlDataAdapter sda = new MySqlDataAdapter("select * from v_sales where salesID = 'XS-2021-02-22-Pzkz'", conn); DataSet ds = new DataSet("ds"); sda.Fill(ds, "test"); CrystalReport2 rd = new CrystalReport2(); rd.SetDataSource(ds.Tables["test"]); this.crystalReportViewer1.ReportSource = rd; } }
//客户端查询订单每隔5秒 private void timer1_Tick(object sender, EventArgs e) { common cmn = new common(); if (depart == "采购员") { using (MySqlConnection conn = new MySqlConnection(cmn.strcon)) { conn.Open(); string sql = "select askstatus from askpricerecord where askstatus = 1"; using (MySqlCommand comm = new MySqlCommand(sql, conn)) { MySqlDataReader myread = comm.ExecuteReader(); if (myread.Read()) { this.isRun = true;//开始闪烁 } else { this.isRun = false; } } } using (MySqlConnection conn = new MySqlConnection(cmn.strcon)) { conn.Open(); string sql = "select tips from extraorderlist where tips = 1"; using (MySqlCommand comm = new MySqlCommand(sql, conn)) { MySqlDataReader myread = comm.ExecuteReader(); if (myread.Read()) { this.isRun = true;//开始闪烁 } else { this.isRun = false; } } } } else if (depart == "业务员") { using (MySqlConnection conn = new MySqlConnection(cmn.strcon)) { conn.Open(); string sql = "select answerstatus from askpricerecord where answerstatus = 1 and opuser = '******'"; using (MySqlCommand comm = new MySqlCommand(sql, conn)) { MySqlDataReader myread = comm.ExecuteReader(); if (myread.Read()) { this.isRun = true;//开始闪烁 } else { this.isRun = false; } } } } else if (depart == "业务员") { using (MySqlConnection conn = new MySqlConnection(cmn.strcon)) { conn.Open(); string sql = "select orderstatus from stockuprecord where orderstatus = 1 and username = '******'"; using (MySqlCommand comm = new MySqlCommand(sql, conn)) { MySqlDataReader myread = comm.ExecuteReader(); if (myread.Read()) { this.isRun = true;//开始闪烁 } else { this.isRun = false; } } } } else if (depart == "仓库员" || classify.Length > 0) { using (MySqlConnection conn = new MySqlConnection(cmn.strcon)) { conn.Open(); string sql = "select stockstatus from stockuprecord where stockstatus = 1"; using (MySqlCommand comm = new MySqlCommand(sql, conn)) { MySqlDataReader myread = comm.ExecuteReader(); if (myread.Read()) { this.isRun = true;//开始闪烁 } else { this.isRun = false; } } } } }