In my project i use EF4, but the connection string of the EF Context are dynamically generated and not saved in any Configuration file, everything works fine...
When i want to use Crystal report to view my reports, I used Datasets that import data form the my Entities (linq), and than set the Datasets as Datasources to the reports
Tutorial Here
But at the moment of the display (in the CrystalReportViewer) a login prompt window pops up, asking for Login & Password (also the Server name and database name but the fields are disabled)
Print Screen Here
I Googled and i noticed that most of the solutions proposed concentrate around : Setting credentials in the code (like this) :
ConnectionInfo crconnectioninfo = new ConnectionInfo();
crconnectioninfo.ServerName = "localhost";
crconnectioninfo.DatabaseName = "dbclients";
crconnectioninfo.UserID = "ssssssss";
crconnectioninfo.Password = "xxxxxxx";
but here is how i create my report :
for (i = 0; i < 7; i++)
{
DataRow dr = container.NewRow();
dr = CreateRowFromMirrorRow(dr, i);
container.Rows.Add(dr);
}
objRpt.SetDataSource(container.DefaultView);
crystalReportViewer1.ReportSource = objRpt;
crystalReportViewer1.Refresh();
crystalReportViewer1.Visible = true;
My questions are :
1/ Why do i have to pass any database credentials since there is no direct connection between the CrReport or the Dataset with the Database?
2/ How do i set the credential of a Dataset (or crystal report) using a ConnectionInfo object (in my case)?