Friday, March 30, 2012

Log on server error

Hi all i am using crystal report with asp .net.

i am using report files already created an configured with a dsn.

when i try to view the report using crystal report viewer in a web form i am getting the error

"CrystalDecisions.CrystalReports.Engine.LogOnException: Logon failed."

i am using

<code>
ConnectionInfo cnnInfo = new ConnectionInfo ( ) ;

cnnInfo.ServerName = strConnInformation[0] ;
cnnInfo.DatabaseName = strConnInformation[1] ;
cnnInfo.UserID = strConnInformation[2] ;
cnnInfo.Password = strConnInformation[3] ;

ReportDocument rptDoc = new ReportDocument ( ) ;
rptDoc.Load ( Server.MapPath ( "..//Reports//" + reportFileName ),
OpenReportMethod.OpenReportByDefault ) ;

//CrystalDecisions.CrystalReports.Engine.Table table = rptDoc.Database.Tables[0] ;

CrystalDecisions.CrystalReports.Engine.Tables rptTables = rptDoc.Database.Tables ;
foreach ( CrystalDecisions.CrystalReports.Engine.Table tbl in rptTables )
{
tblLogOnInfo = tbl.LogOnInfo ;
tblLogOnInfo.ConnectionInfo = cnnInfo ;
tbl.ApplyLogOnInfo ( tblLogOnInfo ) ;

if ( tbl.Location.IndexOf ( "." ) > 0 )
{
tbl.Location = tbl.Location.Substring (
tbl.Location.LastIndexOf(".") + 1 ) ;
}
else
{
//tbl.Location = tbl.Location ;
}
}

</code>

its working fine when i try to execute a report file which configured direct to a database in another machine by specifying the server name, database name, user id and the password,

its showing the error only when i try to execute the report which configured using dsn. dsn is created in my machine and the actual database server is another one.

can any one help me in this matter as i have to use the reports with dsn only in my application.

i got the informations from the net that its same for both type of connectivity to use the ConnectionInfo object and the TableLogonInfo objects.

what my be the problem with me.

is its related to any permision issues.Hai Vinod,

Even i faced the same problem with my C# and Access .
But this prblem arised only when i have a subreport in my main report.

Do u have any subreports in ur appli...If so u have to provide login information to those reports also.

regards,
Kolluru.|||Thanks for your reply kolluru. i will try this and will get back :)|||Do u have any subreports in ur appli...If so u have to provide login information to those reports also.

Im having the same problem and I have subreports. How do you provide the login details for the subreports?sql

No comments:

Post a Comment