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 crReportDocumen t = new ReportDocument( );
string strPath;
strPath = Server.MapPath( "Reports\\Cryst alReport1.rpt") ;
string select = "SELECT * FROM Security";
SqlConnection conPubs = new
SqlConnection(C onfigurationSet tings.AppSettin gs["ConnectionStri ng"]);
conPubs.Open();
SqlCommand cmd = new SqlCommand(sele ct,conPubs);
SqlDataReader dtrUsers = cmd.ExecuteRead er();
strPath = Server.MapPath( "Reports\\Cryst alReport1.rpt") ;
crReportDocumen t.Load(strPath) ;
crReportDocumen t.SetDataSource (dtrUsers);
BUT THIS WORKED:
ReportDocument crReportDocumen t = new ReportDocument( );
string strPath;
strPath = Server.MapPath( "Reports\\Cryst alReport1.rpt") ;
string select = "SELECT * FROM Security";
SqlConnection conPubs = new
SqlConnection(C onfigurationSet tings.AppSettin gs["ConnectionStri ng"]);
conPubs.Open();
SqlCommand cmd = new SqlCommand(sele ct,conPubs);
SqlDataReader dtrUsers = cmd.ExecuteRead er();
strPath = Server.MapPath( "Reports\\Cryst alReport1.rpt") ;
crReportDocumen t.Load(strPath) ;
crReportDocumen t.SetDataSource (dtrUsers);
crConnectionInf o.ServerName = "Roma";
crConnectionInf o.DatabaseName = "ProjectManagem ent";
crConnectionInf o.
crConnectionInf o.UserID = "sa";
crConnectionInf o.Password = "Pioneer#ca ke";
crDatabase = crReportDocumen t.Database;
crTables = crDatabase.Tabl es;
foreach(Crystal Decisions.Cryst alReports.Engin e.Table crTable in crTables)
{
crTableLogOnInf o = crTable.LogOnIn fo;
crTableLogOnInf o.ConnectionInf o = crConnectionInf o;
crTable.ApplyLo gOnInfo(crTable LogOnInfo);
}
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*******@disc ussions.microso ft.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.Databa se.Tables(0).Se tDataSource(dat atable);
But some people reported that this approach has poor
performance when loading large amount data.
HTH
Elton Wang
el********@hotm ail.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 theCrystalView er 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;3192 64&sd=msdn
even with that information from Microsoft, I still cannot
get the stupidthing to work. still get the error Exception Details:
CrystalDecisi ons.CrystalRepo rts.Engine.LogO nException:
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
.