2016-08-12 17 views
0

我在asp.net c#中的stimulsoft中創建了一個報告。我創建了一個新的連接,然後創建了新的數據源,併爲其添加了一個現有的存儲過程。那麼我指定列和參數此數據源到我的report.my的問題是: 當我創造新的SqlConnection手動連接字符串:我如何在運行時設置web服務的stimulsoft報告連接字符串

Data Source=my_pc-PC\my_servername;Integrated Security=True;Initial Catalog=my database_name 

當我在我的電腦上運行我的網站每一件事情是一個好工作。但是當我在網絡服務上設置我的網站時,我是否會做任何事情來成功顯示我的報告。 我對運行報告代碼:

Stimulsoft.Report.Components.StiText t = new Stimulsoft.Report.Components.StiText(); 
     t.Text = DateLabel.Text; 
     string str4 = Decrypt(Request.QueryString["select_rep_"]); 
     if (str4 == "1") 
     { 
      string str1 = Decrypt(Request.QueryString["fromdate_"]); 
      string str2 = Decrypt(Request.QueryString["todate_"]); 

      string ConnectionString = ConfigurationManager.ConnectionStrings["my_ejraConnectionString"].ConnectionString; 
      string serverlocation = HttpContext.Current.Server.MapPath(string.Empty); 
      StiReport myreport = new StiReport(); 
      myreport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Coneection", ConnectionString)); 
      t.Text = DateLabel.Text; 
      myreport.Load(serverlocation + "\\rep\\myreport.mrt"); 
      myreport.Dictionary.Variables["fromdate"].Value = str1; 
      myreport.Dictionary.Variables["todate"].Value = str2; 
      myreport.Dictionary.Variables["today"].Value = t.Text; 
      StiWebViewer1.Report = myreport; 
     }`enter code here` 

是沒有使用Web服務器上的任何改變此代碼的工作?

+0

檢查連接字符串。在Web服務上它是一樣的嗎? 你有什麼錯誤嗎?或者只有一個空的查看器?你看到查看器了嗎? – HighAley

+0

嗨,感謝您的回覆。我不提供我的網站yet.i想知道是我的代碼工作,沒有任何改變的網絡服務器? – reza

回答

0

做這個cleare數據庫之前使用它:

myreport.Dictionary.Databases.Clear();

myreport.Dictionary.Databases.Add(new StiSqlDatabase(「ConnectionName」,「ConnectionString」));

相關問題