Click here to Skip to main content
15,896,606 members
Home / Discussions / C#
   

C#

 
Questionusing a delayed sign assembly Pin
prasadbuddhika8-Apr-10 6:37
prasadbuddhika8-Apr-10 6:37 
Questionwrite a program like windows magnify Pin
itresearches8-Apr-10 5:09
itresearches8-Apr-10 5:09 
AnswerRe: write a program like windows magnify Pin
EliottA8-Apr-10 8:50
EliottA8-Apr-10 8:50 
QuestionAccessing to a control created at runtime Pin
aleroot8-Apr-10 5:05
aleroot8-Apr-10 5:05 
AnswerRe: Accessing to a control created at runtime Pin
OriginalGriff8-Apr-10 5:28
mveOriginalGriff8-Apr-10 5:28 
GeneralRe: Accessing to a control created at runtime Pin
aleroot8-Apr-10 5:40
aleroot8-Apr-10 5:40 
GeneralRe: Accessing to a control created at runtime Pin
aleroot8-Apr-10 9:42
aleroot8-Apr-10 9:42 
QuestionPassing database login info to Crystal report - problem going to production Pin
jamesc698-Apr-10 4:54
jamesc698-Apr-10 4:54 
Firstly, I have this working in development, however when I publish to the production webserver, instead of generating the report, it asks me for login credentials again.

Here is a snapshot of my entire code behind file:

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;



public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if ((ViewState["ParametersShown"] != null) &&
(ViewState["ParametersShown"].ToString() == "True"))
{
ReportListing myListing = new ReportListing();
BindReport(ConfigurationManager.AppSettings["reportlocation"].ToString() +

myListing.GetReportFileName(Session["Report"].ToString()));
}
}



protected void btnBuild_Click(object sender, EventArgs e)
{
CrystalReportViewer1.ParameterFieldInfo.Clear();
DateTime startDate = DateTime.Parse(Session["FromDate"].ToString());
DateTime endDate = DateTime.Parse(Session["ToDate"].ToString());


ParameterFields paramFields = new ParameterFields();

ParameterField crStartDate = new ParameterField();
ParameterField crEndDate = new ParameterField();
crStartDate.Name = "@StartDate";
crEndDate.Name = "@EndDate";
ParameterDiscreteValue dcrStartDate = new ParameterDiscreteValue();
ParameterDiscreteValue dcrEndDate = new ParameterDiscreteValue();
dcrStartDate.Value = startDate;
dcrEndDate.Value = endDate;

crStartDate.CurrentValues.Add(dcrStartDate);
crEndDate.CurrentValues.Add(dcrEndDate);

paramFields.Add(crStartDate);
paramFields.Add(crEndDate);


ReportListing myListing = new ReportListing();
BindReport(ConfigurationManager.AppSettings["reportlocation"].ToString() +

myListing.GetReportFileName(Session["Report"].ToString()));
CrystalReportViewer1.ParameterFieldInfo = paramFields;
ViewState["ParametersShown"] = "True";
ViewState["ReportName"] = Session["Report"].ToString();
}

private void BindReport(string FilePath)
{
ReportDocument Report = new ReportDocument();
Report.Load(FilePath);
SetTableLocation(Report.Database.Tables);
CrystalReportViewer1.ReportSource = Report;

}

private void SetTableLocation(Tables tables)
{
ConnectionInfo connectionInfo = new ConnectionInfo();
connectionInfo.ServerName = ConfigurationManager.AppSettings["ReportDBServerName"].ToString();
connectionInfo.DatabaseName = ConfigurationManager.AppSettings["ReportDBDBName"].ToString();
connectionInfo.UserID = ConfigurationManager.AppSettings["ReportDBUserID"].ToString();
connectionInfo.Password = ConfigurationManager.AppSettings["ReportDBPassword"].ToString();

foreach (CrystalDecisions.CrystalReports.Engine.Table table in tables)
{
TableLogOnInfo tableLogOnInfo = table.LogOnInfo;
tableLogOnInfo.ConnectionInfo = connectionInfo;
table.ApplyLogOnInfo(tableLogOnInfo);
}

}
}

As detailed above, running from a local machine it works fine it is only when published to production server it asks for login details. Login details are stored in the web.config file and are correct.

Please help!

Thanks
Questionstatic property with polymorphism Pin
lukeer8-Apr-10 4:12
lukeer8-Apr-10 4:12 
AnswerRe: static property with polymorphism Pin
PIEBALDconsult8-Apr-10 4:28
mvePIEBALDconsult8-Apr-10 4:28 
GeneralRe: static property with polymorphism Pin
lukeer8-Apr-10 4:34
lukeer8-Apr-10 4:34 
AnswerRe: static property with polymorphism Pin
Jimmanuel8-Apr-10 4:38
Jimmanuel8-Apr-10 4:38 
AnswerRe: static property with polymorphism Pin
Luc Pattyn8-Apr-10 4:46
sitebuilderLuc Pattyn8-Apr-10 4:46 
AnswerRe: static property with polymorphism Pin
PIEBALDconsult8-Apr-10 5:06
mvePIEBALDconsult8-Apr-10 5:06 
GeneralRe: static property with polymorphism Pin
harold aptroot8-Apr-10 6:10
harold aptroot8-Apr-10 6:10 
GeneralRe: static property with polymorphism Pin
Luc Pattyn8-Apr-10 6:59
sitebuilderLuc Pattyn8-Apr-10 6:59 
GeneralRe: static property with polymorphism Pin
PIEBALDconsult8-Apr-10 8:13
mvePIEBALDconsult8-Apr-10 8:13 
AnswerSolved: static property with polymorphism Pin
lukeer9-Apr-10 2:59
lukeer9-Apr-10 2:59 
QuestionCOM port send/receive Pin
mprice2148-Apr-10 4:02
mprice2148-Apr-10 4:02 
AnswerRe: COM port send/receive Pin
PIEBALDconsult8-Apr-10 4:16
mvePIEBALDconsult8-Apr-10 4:16 
GeneralRe: COM port send/receive Pin
mprice2148-Apr-10 4:23
mprice2148-Apr-10 4:23 
GeneralRe: COM port send/receive Pin
PIEBALDconsult8-Apr-10 5:25
mvePIEBALDconsult8-Apr-10 5:25 
GeneralRe: COM port send/receive Pin
mprice2148-Apr-10 8:42
mprice2148-Apr-10 8:42 
GeneralRe: COM port send/receive Pin
PIEBALDconsult8-Apr-10 11:25
mvePIEBALDconsult8-Apr-10 11:25 
GeneralRe: COM port send/receive Pin
mprice2148-Apr-10 14:20
mprice2148-Apr-10 14:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.