2012-03-16 10 views
0

私は水晶レポートを作成しようとしていて、ページの背後にあるコードは次のようになります。私がアプリケーションを実行すると、Webページが結果なしで何時間も読み込まれます。 ...水晶レポートsap .net

namespace WebApplication11 

{ 
    public partial class About : System.Web.UI.Page 
    { 
     //  Below is the final code for reports. 
     protected void Page_Load(object sender, EventArgs e) 
     { 
      ReportDocument rptDoc = new ReportDocument(); 
      DataSet1 ds = new DataSet1(); // .xsd file name 
      DataTable dt = new DataTable(); 
      // Just set the name of data table 
      dt.TableName = "db.Customer_Orders"; 
      dt = getAllOrders(); //This function is located below this function 
      ds.Tables[0].Merge(dt); 
      // Your .rpt file path will be below 
      rptDoc.Load(Server.MapPath("c:/users/dell/documents/visual studio 2010/Projects/WebApplication11/WebApplication11/CrystalReport1.rpt")); 
      //set dataset to the report viewer. 
      rptDoc.SetDataSource(ds); 
      CrystalReportViewer1.ReportSource = rptDoc; 
     } 
     public DataTable getAllOrders() 
     { 
      //Connection string replcae 'databaseservername' with your db server name 
      string sqlCon = "User ID=User-PC;PWD=; server=USER-PC/SQLEXPRESS;INITIAL CATALOG=SampleDB;PERSIST SECURITY INFO=FALSE;Connect Timeout=0"; 
      SqlConnection Con = new SqlConnection(sqlCon); 
      SqlCommand cmd = new SqlCommand(); 
      DataSet ds = null; 
      SqlDataAdapter adapter; 
      try 
      { 
       Con.Open(); 
       //Stored procedure calling. It is already in sample db. 
       cmd.CommandText = "getAllOrders"; 
       cmd.CommandType = CommandType.StoredProcedure; 
       cmd.Connection = Con; 
       ds = new DataSet(); 
       adapter = new SqlDataAdapter(cmd); 
       adapter.Fill(ds, "Users"); 
      } 
      catch (Exception ex) 
      { 
       throw new Exception(ex.Message); 
      } 
      finally 
      { 
       cmd.Dispose(); 
       if (Con.State != ConnectionState.Closed) 
        Con.Close(); 
      } 
      return ds.Tables[0]; 
     } 



    } 
} 
+0

ストアドプロシージャを手動で実行しようとしましたか?それはどれくらい時間がかかりますか? –

+0

デバッガをワーカープロセスに接続して、ブロックされている場所を確認しようとしましたか? – Tung

答えて

0

私はあなたがCrystalReportViewer1.ReportSource = rptDoc;後の行が不足しているように見えると思う:

crystalReportViewer1.Refresh();

しかし、桐はブレークポイントを添付し、ステップスルーそれが立ち往生だ場所を確認するsaid-として。

関連する問題