Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post May 03, 2012 04:01 AM by Mamba Dai - MSFT
Participant
960 Points
458 Posts
Apr 26, 2012 05:59 AM|LINK
hi all
my Crysatl Report is working Fine in Local machine.. when i tried to deploy on Server its giving Error Message as " Data Base Log On Failed"
While creating CR i gave my Local server Authentication Details and while deploying its not taking server side authentiacation
can any one suggest me wat to do its urgent...?
Member
77 Points
15 Posts
Apr 26, 2012 06:15 AM|LINK
Hi
Hope ur using Oracle as database. if So Please check the below mentioned code.
public static ReportDocument ConnectionInfo(ReportDocument rpt, string TableLocation) {
try { ReportDocument crSubreportDocument; string[] strConnection = ConfigurationManager.ConnectionStrings[("AppConn")].ConnectionString.Split(new char[] { ';' }); Database oCRDb = rpt.Database; Tables oCRTables = oCRDb.Tables; CrystalDecisions.CrystalReports.Engine.Table oCRTable = default(CrystalDecisions.CrystalReports.Engine.Table); TableLogOnInfo oCRTableLogonInfo = default(CrystalDecisions.Shared.TableLogOnInfo); ConnectionInfo oCRConnectionInfo = new CrystalDecisions.Shared.ConnectionInfo();
oCRConnectionInfo.ServerName = strConnection[0].Split(new char[] { '=' }).GetValue(1).ToString(); oCRConnectionInfo.Password = strConnection[2].Split(new char[] { '=' }).GetValue(1).ToString(); oCRConnectionInfo.UserID = strConnection[1].Split(new char[] { '=' }).GetValue(1).ToString();
for (int i = 0; i < oCRTables.Count; i++) { oCRTable = oCRTables[i]; oCRTableLogonInfo = oCRTable.LogOnInfo; oCRTableLogonInfo.ConnectionInfo = oCRConnectionInfo; oCRTable.ApplyLogOnInfo(oCRTableLogonInfo); oCRTable.Location = TableLocation + "." + oCRTable.Location; }
for (int i = 0; i < rpt.Subreports.Count; i++) { { crSubreportDocument = rpt.OpenSubreport(rpt.Subreports[i].Name); oCRDb = crSubreportDocument.Database; oCRTables = oCRDb.Tables; foreach (CrystalDecisions.CrystalReports.Engine.Table aTable in oCRTables) { oCRTableLogonInfo = aTable.LogOnInfo; oCRTableLogonInfo.ConnectionInfo = oCRConnectionInfo; aTable.ApplyLogOnInfo(oCRTableLogonInfo); aTable.Location = TableLocation + "." + aTable.Location; }
}
} catch (Exception ex) { //if (ExceptionPolicy.HandleException(ex, "General")) // throw; } return rpt; }
The parameter TableLocation U have to pass the Owner name of the Schema. for example
if Your table name is Employee and the Schema user name is HRS. Pass HRS as the TableLocation. coz in Crystal report we are using only the table name.
Hope it hepls
Madhuraj.M
madhurajm@gmail.com
All-Star
23531 Points
2683 Posts
Microsoft
May 03, 2012 04:01 AM|LINK
Hi,
For CP issue please post your question to this:
http://forums.asp.net/76.aspx/1?Crystal+Reports
You will receive more professional and exact idea from there.
narasappa
Participant
960 Points
458 Posts
Problem in Deploying crystal Report On Server
Apr 26, 2012 05:59 AM|LINK
hi all
my Crysatl Report is working Fine in Local machine.. when i tried to deploy on Server its giving Error Message as " Data Base Log On Failed"
While creating CR i gave my Local server Authentication Details and while deploying its not taking server side authentiacation
can any one suggest me wat to do its urgent...?
ravi.jadiyannavar@gmail.com
Pls Mark This Post As Answer If it Helps U..
Thanku
Bhavyashri
Member
77 Points
15 Posts
Re: Problem in Deploying crystal Report On Server
Apr 26, 2012 06:15 AM|LINK
Hi
Hope ur using Oracle as database. if So Please check the below mentioned code.
public static ReportDocument ConnectionInfo(ReportDocument rpt, string TableLocation)
{
try
{
ReportDocument crSubreportDocument;
string[] strConnection = ConfigurationManager.ConnectionStrings[("AppConn")].ConnectionString.Split(new char[] { ';' });
Database oCRDb = rpt.Database;
Tables oCRTables = oCRDb.Tables;
CrystalDecisions.CrystalReports.Engine.Table oCRTable = default(CrystalDecisions.CrystalReports.Engine.Table);
TableLogOnInfo oCRTableLogonInfo = default(CrystalDecisions.Shared.TableLogOnInfo);
ConnectionInfo oCRConnectionInfo = new CrystalDecisions.Shared.ConnectionInfo();
oCRConnectionInfo.ServerName = strConnection[0].Split(new char[] { '=' }).GetValue(1).ToString();
oCRConnectionInfo.Password = strConnection[2].Split(new char[] { '=' }).GetValue(1).ToString();
oCRConnectionInfo.UserID = strConnection[1].Split(new char[] { '=' }).GetValue(1).ToString();
for (int i = 0; i < oCRTables.Count; i++)
{
oCRTable = oCRTables[i];
oCRTableLogonInfo = oCRTable.LogOnInfo;
oCRTableLogonInfo.ConnectionInfo = oCRConnectionInfo;
oCRTable.ApplyLogOnInfo(oCRTableLogonInfo);
oCRTable.Location = TableLocation + "." + oCRTable.Location;
}
for (int i = 0; i < rpt.Subreports.Count; i++)
{
{
crSubreportDocument = rpt.OpenSubreport(rpt.Subreports[i].Name);
oCRDb = crSubreportDocument.Database;
oCRTables = oCRDb.Tables;
foreach (CrystalDecisions.CrystalReports.Engine.Table aTable in oCRTables)
{
oCRTableLogonInfo = aTable.LogOnInfo;
oCRTableLogonInfo.ConnectionInfo = oCRConnectionInfo;
aTable.ApplyLogOnInfo(oCRTableLogonInfo);
aTable.Location = TableLocation + "." + aTable.Location;
}
}
}
}
catch (Exception ex)
{
//if (ExceptionPolicy.HandleException(ex, "General"))
// throw;
}
return rpt;
}
The parameter TableLocation U have to pass the Owner name of the Schema. for example
if Your table name is Employee and the Schema user name is HRS. Pass HRS as the TableLocation. coz in Crystal report we are using only the table name.
Hope it hepls
Madhuraj.M
madhurajm@gmail.com
Mamba Dai - ...
All-Star
23531 Points
2683 Posts
Microsoft
Re: Problem in Deploying crystal Report On Server
May 03, 2012 04:01 AM|LINK
Hi,
For CP issue please post your question to this:
http://forums.asp.net/76.aspx/1?Crystal+Reports
You will receive more professional and exact idea from there.
Feedback to us
Develop and promote your apps in Windows Store