title: How to use Sessions in asp.net with crystal reports
body: <p>I am new to .net and C# and my asp crystal report will not print or export. I have read that you have to use sessions to do this. Can anyone give me any tips for this? I have a basic web page setup that lets you see our report and input a parameter. That is working fine. Whenever I try to print or export my page starts to do something then stops and I get nothing. Any suggestions?here is my code</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
       SqlConnection CN;
       String MyConnectionString = null;
       MyConnectionString =  "data source=srv;initial catalog=db;user id=reports;password=";
       CN = new SqlConnection(MyConnectionString);
       CN.Open();
       string SQL = null;
       SQL =  "SELECT oeordhdr_sql.ord_no,  oeordlin_sql.line_seq_no, oeordlin_sql.qty_to_ship, oeordlin_sql.cus_item_no, imitmidx_sql.upc_cd, imitmidx_sql.item_desc_1, oelincmt_sql.cmt, oeordhdr_sql.ship_to_name, oeordhdr_sql.ship_to_addr_1, oeordhdr_sql.ship_to_addr_2, oeordhdr_sql.ship_to_addr_3, oeordhdr_sql.ship_to_addr_4,sycdefil_sql.cd_type, sycdefil_sql.code_desc FROM(((oeordhdr_sql   oeordhdr_sql  INNER JOIN  oeordlin_sql   oeordlin_sql  ON( oeordhdr_sql.ord_type  =  oeordlin_sql.ord_type ) AND( oeordhdr_sql.ord_no  =  oeordlin_sql.ord_no )) LEFT OUTER JOIN  oelincmt_sql   oelincmt_sql  ON  oeordhdr_sql.ord_no  =  oelincmt_sql.ord_no ) LEFT OUTER JOIN  sycdefil_sql   sycdefil_sql  ON  oeordhdr_sql.ship_via_cd  =  sycdefil_sql.sy_code ) INNER JOIN  imitmidx_sql   imitmidx_sql  ON  oeordlin_sql.item_no  =  imitmidx_sql.item_no WHERE sycdefil_sql.cd_type  = 'V' AND  oeordhdr_sql.ord_no  = ' {?Ord_no}' ORDER BY  oeordhdr_sql.ord_no";
  
       SqlDataAdapter myDa = new SqlDataAdapter(SQL, CN);
       CN.Close();
       DataSet DS = new DataSet();
       myDa.Fill(DS, "DataTable1");
       ReportDocument myRPT = new ReportDocument();
       myRPT.Load(Server.MapPath("~/CrystalReport.rpt"));
       myRPT.SetDataSource(DS);
       CrystalReportViewer1.ReportSource = myRPT;
  }
  </code></pre>