By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,987 Members | 1,552 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,987 IT Pros & Developers. It's quick & easy.

Crystal Reports

P: n/a
I have come across lots of information regarding this, but nothing seems to
work. I have created a Crystal Report that access's a SQL server backend for
the data, and I want to display the report via a webform and the
CrystalViewer Web Component. First of all, I have been using Trusted
Connections so far (for data access) and really do not want to have some
static login information in my web app. but most of the documents so far
have indicated this has to be the case (for use with a SQL Server Backend).

http://support.microsoft.com/default...319264&sd=msdn

even with that information from Microsoft, I still cannot get the stupid
thing to work. still get the error Exception Details:
CrystalDecisions.CrystalReports.Engine.LogOnExcept ion: Logon failed

If I setup my crystal report to access certain info from a table called
mytable, can I use the same SQL String in a dataset and bind the dataset to
the report. Would this work? or is binding a dataset to a report for
dynamically creating a report (I would like to format the report visually).
Can anyone point me in the right direction here. Thank you
Nov 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi Shawn,

In my experience, a CR report in .NET doesn't have to have
log on info for get data from database. You can fill the
datatable first then use datatable as CR report's data
source, e.g.

crReport.Database.Tables(0).SetDataSource(datatabl e);

But some people reported that this approach has poor
performance when loading large amount data.
HTH

Elton Wang
el********@hotmail.com
-----Original Message-----
I have come across lots of information regarding this, but nothing seems towork. I have created a Crystal Report that access's a SQL server backend forthe data, and I want to display the report via a webform and theCrystalViewer Web Component. First of all, I have been using TrustedConnections so far (for data access) and really do not want to have somestatic login information in my web app. but most of the documents so farhave indicated this has to be the case (for use with a SQL Server Backend).
http://support.microsoft.com/default.aspx? scid=kb;en;319264&sd=msdn
even with that information from Microsoft, I still cannot get the stupidthing to work. still get the error Exception Details:
CrystalDecisions.CrystalReports.Engine.LogOnExcep tion: Logon failed
If I setup my crystal report to access certain info from a table calledmytable, can I use the same SQL String in a dataset and bind the dataset tothe report. Would this work? or is binding a dataset to a report fordynamically creating a report (I would like to format the report visually).Can anyone point me in the right direction here. Thank you

.

Nov 19 '05 #2

P: n/a
No Luck. I coded to open a dataset, I got the info from the database without
problems, and set the datasource for the report to my dataset. It didn't
work until I supplied Logon info again.

This didn't work:
ReportDocument crReportDocument = new ReportDocument();
string strPath;

strPath = Server.MapPath("Reports\\CrystalReport1.rpt");
string select = "SELECT * FROM Security";
SqlConnection conPubs = new
SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
conPubs.Open();
SqlCommand cmd = new SqlCommand(select,conPubs);
SqlDataReader dtrUsers = cmd.ExecuteReader();

strPath = Server.MapPath("Reports\\CrystalReport1.rpt");
crReportDocument.Load(strPath);
crReportDocument.SetDataSource(dtrUsers);

BUT THIS WORKED:

ReportDocument crReportDocument = new ReportDocument();
string strPath;

strPath = Server.MapPath("Reports\\CrystalReport1.rpt");
string select = "SELECT * FROM Security";
SqlConnection conPubs = new
SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
conPubs.Open();
SqlCommand cmd = new SqlCommand(select,conPubs);
SqlDataReader dtrUsers = cmd.ExecuteReader();

strPath = Server.MapPath("Reports\\CrystalReport1.rpt");
crReportDocument.Load(strPath);
crReportDocument.SetDataSource(dtrUsers);

crConnectionInfo.ServerName = "Roma";
crConnectionInfo.DatabaseName = "ProjectManagement";
crConnectionInfo.
crConnectionInfo.UserID = "sa";
crConnectionInfo.Password = "Pioneer#cake";
crDatabase = crReportDocument.Database;
crTables = crDatabase.Tables;

foreach(CrystalDecisions.CrystalReports.Engine.Tab le crTable in crTables)
{
crTableLogOnInfo = crTable.LogOnInfo;
crTableLogOnInfo.ConnectionInfo = crConnectionInfo;
crTable.ApplyLogOnInfo(crTableLogOnInfo);
}

It seems to only work when supplied with a username and password. Like I
said before, I have found many docs saying you cannot use trusted
connections with Microsoft SQL Server. I am just looking for code to
actually accomplish this. I have gotten code to work no problem with MS
Access, etc.. Thanks for your help

"Elton Wang" <an*******@discussions.microsoft.com> wrote in message
news:01****************************@phx.gbl...
Hi Shawn,

In my experience, a CR report in .NET doesn't have to have
log on info for get data from database. You can fill the
datatable first then use datatable as CR report's data
source, e.g.

crReport.Database.Tables(0).SetDataSource(datatabl e);

But some people reported that this approach has poor
performance when loading large amount data.
HTH

Elton Wang
el********@hotmail.com
-----Original Message-----
I have come across lots of information regarding this,

but nothing seems to
work. I have created a Crystal Report that access's a SQL

server backend for
the data, and I want to display the report via a webform

and the
CrystalViewer Web Component. First of all, I have been

using Trusted
Connections so far (for data access) and really do not

want to have some
static login information in my web app. but most of the

documents so far
have indicated this has to be the case (for use with a

SQL Server Backend).

http://support.microsoft.com/default.aspx?

scid=kb;en;319264&sd=msdn

even with that information from Microsoft, I still cannot

get the stupid
thing to work. still get the error Exception Details:
CrystalDecisions.CrystalReports.Engine.LogOnExce ption:

Logon failed

If I setup my crystal report to access certain info from

a table called
mytable, can I use the same SQL String in a dataset and

bind the dataset to
the report. Would this work? or is binding a dataset to a

report for
dynamically creating a report (I would like to format the

report visually).
Can anyone point me in the right direction here. Thank

you


.

Nov 19 '05 #3

P: n/a
That's true. Logon info definitely works. And I think if
you already provide logon info, it's not necessary to use
datareader any more.

Sometimes dataset works, but mostly it only works by using
individual datatables.

Elton Wang

-----Original Message-----
No Luck. I coded to open a dataset, I got the info from the database withoutproblems, and set the datasource for the report to my dataset. It didn'twork until I supplied Logon info again.

This didn't work:
ReportDocument crReportDocument = new ReportDocument();
string strPath;

strPath = Server.MapPath ("Reports\\CrystalReport1.rpt"); string select = "SELECT * FROM Security";
SqlConnection conPubs = new
SqlConnection(ConfigurationSettings.AppSettings ["ConnectionString"]); conPubs.Open();
SqlCommand cmd = new SqlCommand(select,conPubs);
SqlDataReader dtrUsers = cmd.ExecuteReader();

strPath = Server.MapPath ("Reports\\CrystalReport1.rpt"); crReportDocument.Load(strPath);
crReportDocument.SetDataSource(dtrUsers);

BUT THIS WORKED:

ReportDocument crReportDocument = new ReportDocument();
string strPath;

strPath = Server.MapPath ("Reports\\CrystalReport1.rpt"); string select = "SELECT * FROM Security";
SqlConnection conPubs = new
SqlConnection(ConfigurationSettings.AppSettings ["ConnectionString"]); conPubs.Open();
SqlCommand cmd = new SqlCommand(select,conPubs);
SqlDataReader dtrUsers = cmd.ExecuteReader();

strPath = Server.MapPath ("Reports\\CrystalReport1.rpt"); crReportDocument.Load(strPath);
crReportDocument.SetDataSource(dtrUsers);

crConnectionInfo.ServerName = "Roma";
crConnectionInfo.DatabaseName = "ProjectManagement";
crConnectionInfo.
crConnectionInfo.UserID = "sa";
crConnectionInfo.Password = "Pioneer#cake";
crDatabase = crReportDocument.Database;
crTables = crDatabase.Tables;

foreach(CrystalDecisions.CrystalReports.Engine.Tab le crTable in crTables) {
crTableLogOnInfo = crTable.LogOnInfo;
crTableLogOnInfo.ConnectionInfo = crConnectionInfo;
crTable.ApplyLogOnInfo(crTableLogOnInfo);
}

It seems to only work when supplied with a username and password. Like Isaid before, I have found many docs saying you cannot use trustedconnections with Microsoft SQL Server. I am just looking for code toactually accomplish this. I have gotten code to work no problem with MSAccess, etc.. Thanks for your help

"Elton Wang" <an*******@discussions.microsoft.com> wrote in messagenews:01****************************@phx.gbl...
Hi Shawn,

In my experience, a CR report in .NET doesn't have to have log on info for get data from database. You can fill the
datatable first then use datatable as CR report's data
source, e.g.

crReport.Database.Tables(0).SetDataSource(datatabl e);

But some people reported that this approach has poor
performance when loading large amount data.
HTH

Elton Wang
el********@hotmail.com
-----Original Message-----
I have come across lots of information regarding this,

but nothing seems to
work. I have created a Crystal Report that access's a
SQL server backend for
the data, and I want to display the report via a webform

and the
CrystalViewer Web Component. First of all, I have been

using Trusted
Connections so far (for data access) and really do not

want to have some
static login information in my web app. but most of the

documents so far
have indicated this has to be the case (for use with a

SQL Server Backend).

http://support.microsoft.com/default.aspx?

scid=kb;en;319264&sd=msdn

even with that information from Microsoft, I still
cannot get the stupid
thing to work. still get the error Exception Details:
CrystalDecisions.CrystalReports.Engine.LogOnExc eption:

Logon failed

If I setup my crystal report to access certain info from

a table called
mytable, can I use the same SQL String in a dataset and

bind the dataset to
the report. Would this work? or is binding a dataset to
a report for
dynamically creating a report (I would like to format
the report visually).
Can anyone point me in the right direction here. Thank

you


.

.

Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.