private void toolStripButton2_Click(object sender, EventArgs e) { CRVReport.PrintReport(); try { OleDbConnection con = new OleDbConnection(iLoginEx.ConnString()); con.Open(); string sql = "select count(*) from zhrs_t_zzcSO_SOAddSeriesInfo where SO_SOMain_Id=" + SO_SOMain_Id + ""; OleDbCommand com = new OleDbCommand(sql, con); int n = Convert.ToInt32(com.ExecuteScalar()); if (n > 0) { crystalReportViewer1.PrintReport(); } con.Close(); } catch (Exception ex) { MessageBox.Show("发生错误!" + ex.Message); } finally { GC.Collect(); } }