コード例 #1
0
        private void crystalReportViewer1_Load(object sender, EventArgs e)
        {
            QuestionReport cryrpt = new QuestionReport();

            constring = "Data Source=VIREN-PC\\SQLEXPRESS;Initial Catalog=QPGenerator;Integrated Security=True";
            SqlConnection  con = new SqlConnection(constring);
            SqlDataAdapter sda = new SqlDataAdapter("select * from lastquest", con);
            DataSet        dst = new DataSet();

            sda.Fill(dst, "lastquest");
            cryrpt.Load(@"C:\Users\pratik\Documents\Visual Studio 2010\Projects\QuestionPaperGenerater\QuestionPaperGenerater\QuestionReport.rpt");
            cryrpt.SetDataSource(dst);
            crystalReportViewer1.ReportSource = cryrpt;
        }