www.pudn.com > FORU(SMS).rar > SMS_GoodsReport.cs


using System; 
using System.Collections.Generic; 
using System.ComponentModel; 
using System.Data; 
using System.Drawing; 
using System.Text; 
using System.Windows.Forms; 
using System.Data.SqlClient; 
 
namespace FORU_SMS_.CrystalReport 
{ 
    public partial class SMS_GoodsReport : Form 
    { 
        private DataTable dt; 
        private ChkDataSet chkSet = new ChkDataSet(); 
        private ChkCrystalReport chkReport = new ChkCrystalReport(); 
        public SMS_GoodsReport(DataTable dtb) 
        { 
            InitializeComponent(); 
            dt = dtb; 
        } 
 
        private void SMS_GoodsReport_Load(object sender, EventArgs e) 
        { 
            string[] r = new string[5]; 
            foreach (System.Data.DataRow rw in dt.Rows) 
            { 
                r[0] = rw["产品编号"].ToString(); 
                r[1] = rw["产品名称"].ToString(); 
                r[2] = rw["库存数量"].ToString(); 
                r[3] = rw["盘点实数"].ToString(); 
                r[4] = rw["盘点日期"].ToString(); 
                chkSet.Tables[0].Rows.Add(r); 
            } 
            chkReport.SetDataSource(chkSet); 
            this.crystalReportViewer1.ReportSource = chkReport; 
        } 
    } 
}