2013-08-23 83 views
0

我正在使用Visual Studio 2010和SAP Crystal Reports 13.0.5。我有一個類連接到我的SQL數據庫並傳遞更新或select語句。我有一個報告,我傳遞了更新聲明就好了,但是當我通過我的select語句時,報告不會選擇我已經傳遞的值。我也沒有創建報告,但無論我通過報告的價值是什麼,它總是加載相同的內容。在Crystal Reports中傳遞SQL語句

crystalReportViewer1.ReportSource = null; 
      crystalReportViewer1.Visible = false; 
      var cr_singlepo = new singlepo(); 

      crystalReportViewer1.ReportSource = cr_singlepo; 
      //Database connection and info method 
      meth_database_connection_info(); 
      //SQL view statements for lowlumber report 
      var new_DB_Statements = new DB_Statements(); 

      var string_sql = ("SELECT PO.PO_Num, PO.Supplier, PO.DateOrdered, PO.DateRequired, PO.Terms, PO.Freight, PO.FOB, POItems.PO_Num, POItems.Quantity, POItems.Description, POItems.Item, POItems.Price, POItems.KeyNum FROM PO, POItems WHERE PO.PO_Num = POItems.PO_Num and PO.PO_Num =" + cmb_existing_po.SelectedItem); 
      new_DB_Statements.SelectFromDB(string_sql); 

      crystalReportViewer1.Visible = true; 

      crystalReportViewer1.Refresh(); 

有沒有辦法在VS 2010中使用「SQLQuery」,就像你可以在水晶報表8一樣?如果還有其他信息可以發佈,請告訴我。先謝謝您的幫助。

回答

0

您的代碼正在更改查看器的可見性並正在刷新它,但尚不清楚數據傳遞到報告的位置。

+0

這是我遇到的問題。我不確定如何將數據傳遞給報告。 – nate