did you use Typed DataSet to generate Crystal Report ??
if so, then make sure that the Name or the DataTable in "Typed DataSet" and the
Name DataTable that you assign as "RecordSource" to crystal reprort must be same...
I used "Field Explorer window" to create Ole Db (ADO) Connection.
and I provided all information Server Name, ID, Password and DB name during the connection Creation Process.
but when I open the crystal report page. It ask all these info again.
It is anoying to enter this information again and again.
any solution that we save this information some where during connection creation once.
and we don't need to enter it again and again while accessing the crystal report pages.
Set the logon information in you code as shown below. Use this code approach instead.
using System;
using System.Data;
using System.Configuration;
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
{
private ReportDocument rpt;
Even though You have included the logon information when creating the connection(in wizards) you also have to provide the logon information in your code. As u are using vs 2005 which uses crystal reports 10 a logon screen is automatically displayed. If u
would have used crystal reports in vs 2003 an exception would have raised. So to get rid of the login screen include the user id and [password in your code as well as I have shown you in the code sample above.
but Login screen is still asking for the details except one change that now I can see the user ID in my User ID field. but other fields (db name, password) are still showing empty, Although I added the information correctly in the code.
Please Advise what is the Possible problem and how can i fix it.
Please check once again whether you have given the user credentials both while designing the crystal report and in the code. AFAIK it should work. The logon credentials which you give in the wizards should also match the logon credentials in your code. Check
Once.
if my post helped you please MARK AS ANSWER
Sreekanth
Marked as answer by asifjaved on Jan 18, 2008 11:20 AM
My problem is Solved (using Ole Db connection and Crystal report) by using ur code.
But Still there is something in which you can help me.
I am trying to do this by Typed DataSet(using existing connection in my Web.config ConnectionString) and it does not work with the DataSet. Same problem asking for the authentication....
Can you guide me in this case.
Because I want to use my existing project's db connection which is in my web.config file for reports to avoid repeating.
asifjaved
Member
3 Points
13 Posts
Crystal Report Asking for Database Authentication each time when I view Page.
Jan 16, 2008 12:01 PM|LINK
Whenever I open my Crystal Report page, I am taken to the Database Authentication page where I am asked for
User name
Data Name
Password
each time.
Is there a way to avoid this and I save these authentication in my page once.
I am using VS2005, C#.
Any Help will be appriciated.
Thanks
Asif
kaushalparik...
All-Star
26580 Points
3693 Posts
MVP
Re: Crystal Report Asking for Database Authentication each time when I view Page.
Jan 16, 2008 12:11 PM|LINK
did you use Typed DataSet to generate Crystal Report ??
if so, then make sure that the Name or the DataTable in "Typed DataSet" and the Name DataTable that you assign as "RecordSource" to crystal reprort must be same...
hope it helps./.
[KaushaL] || BloG || Twitter
Don't forget to click "Mark as Answer" on the post that helped you.
asifjaved
Member
3 Points
13 Posts
Re: Crystal Report Asking for Database Authentication each time when I view Page.
Jan 17, 2008 07:58 AM|LINK
Hi Kaushalparik27,
I used "Field Explorer window" to create Ole Db (ADO) Connection.
and I provided all information Server Name, ID, Password and DB name during the connection Creation Process.
but when I open the crystal report page. It ask all these info again.
It is anoying to enter this information again and again.
any solution that we save this information some where during connection creation once.
and we don't need to enter it again and again while accessing the crystal report pages.
SreekanthRed...
Member
586 Points
123 Posts
Re: Crystal Report Asking for Database Authentication each time when I view Page.
Jan 17, 2008 11:20 AM|LINK
Hi Asif,
Set the logon information in you code as shown below. Use this code approach instead.
using System;
using System.Data;
using System.Configuration;
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
{
private ReportDocument rpt;
private void Page_Init(object sender, EventArgs e)
{
ConfigureCrystalReports();
}
protected void Page_Load(object sender, EventArgs e)
{
}
private void ConfigureCrystalReports()
{
rpt= new ReportDocument();
string reportPath = Server.MapPath("youreportname.rpt");
rpt.Load(reportPath);
ConnectionInfo connectionInfo = new ConnectionInfo();
connectionInfo.DatabaseName = "Northwind";
connectionInfo.UserID = "user";
connectionInfo.Password="user123";
SetDBLogonForReport(connectionInfo,rpt);
CrystalReportViewer1.ReportSource = rpt;
}
private void SetDBLogonForReport(ConnectionInfo connectionInfo, ReportDocument reportDocument)
{
Tables tables = reportDocument.Database.Tables;
foreach (CrystalDecisions.CrystalReports.Engine.Table table in tables)
{
TableLogOnInfo tableLogonInfo = table.LogOnInfo;
tableLogonInfo.ConnectionInfo = connectionInfo;
table.ApplyLogOnInfo(tableLogonInfo);
}
}
}
If my post helped you please MARK AS ANSWER.
Regards
Sreekanth..
asifjaved
Member
3 Points
13 Posts
Re: Crystal Report Asking for Database Authentication each time when I view Page.
Jan 17, 2008 12:24 PM|LINK
I also used Typed Dataset. but could not solve the problem.
I am beginner to asp.net so guide me in details.
SreekanthRed...
Member
586 Points
123 Posts
Re: Crystal Report Asking for Database Authentication each time when I view Page.
Jan 17, 2008 12:32 PM|LINK
HI Asif,
Even though You have included the logon information when creating the connection(in wizards) you also have to provide the logon information in your code. As u are using vs 2005 which uses crystal reports 10 a logon screen is automatically displayed. If u would have used crystal reports in vs 2003 an exception would have raised. So to get rid of the login screen include the user id and [password in your code as well as I have shown you in the code sample above.
If my post helped you please MARK AS ANSWER
Thanks and Regards,
Srikanth.
asifjaved
Member
3 Points
13 Posts
Re: Crystal Report Asking for Database Authentication each time when I view Page.
Jan 18, 2008 07:50 AM|LINK
Hello Srikanth,
I did exactly as you mentioned above.
but Login screen is still asking for the details except one change that now I can see the user ID in my User ID field. but other fields (db name, password) are still showing empty, Although I added the information correctly in the code.
Please Advise what is the Possible problem and how can i fix it.
Thanks so much for you help
Asif
.
SreekanthRed...
Member
586 Points
123 Posts
Re: Crystal Report Asking for Database Authentication each time when I view Page.
Jan 18, 2008 08:50 AM|LINK
Asif,
Please check once again whether you have given the user credentials both while designing the crystal report and in the code. AFAIK it should work. The logon credentials which you give in the wizards should also match the logon credentials in your code. Check Once.
if my post helped you please MARK AS ANSWER
Sreekanth
asifjaved
Member
3 Points
13 Posts
Re: Crystal Report Asking for Database Authentication each time when I view Page.
Jan 18, 2008 09:50 AM|LINK
Sreekanth,
Thanks very much for your prompt reply.
My problem is Solved (using Ole Db connection and Crystal report) by using ur code.
But Still there is something in which you can help me.
I am trying to do this by Typed DataSet(using existing connection in my Web.config ConnectionString) and it does not work with the DataSet. Same problem asking for the authentication....
Can you guide me in this case.
Because I want to use my existing project's db connection which is in my web.config file for reports to avoid repeating.
Thanks in advance.
Asif
SreekanthRed...
Member
586 Points
123 Posts
Re: Crystal Report Asking for Database Authentication each time when I view Page.
Jan 18, 2008 10:07 AM|LINK
HI Asif,
Instead of binding the dataset try binding the DataTable it should work. I did this and it worked for me.
If my post helped you please MARK AS ANSWER
Regards,
Sreekanth Reddy. L