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 Here Is A Tutorial
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)

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); //Methode that creates a Row
container.Rows.Add(dr);
}
objRpt.SetDataSource(container.DefaultView);
// Binding the crystalReportViewer with our report object.
crystalReportViewer1.ReportSource = objRpt;
crystalReportViewer1.Refresh();
crystalReportViewer1.Visible = true;
My questions are :
Why do i have to pass any database credentials since there is no direct connection between the CrReport or the Dataset with the Database?
How do i set the credential of a Dataset (or crystal report) using a ConnectionInfo object (in my case)?