EDIT: Saw your edit, so i'll keep my original post but have to say.. I've never had a crystal report in design mode in VS so I can't be of much help there sorry.
report.SetDatabaseLogon(UserID, Password, ServerName, DatabaseName);
After that you have to roll through all referenced tables in the report and recurse through subreports and reset their logoninfo to one based on the reports connectioninfo.
private void FixDatabase(ReportDocument report)
{
ConnectionInfo crystalConnectionInfo = someConnectionInfo;
foreach (Table table in report.Database.Tables)
{
TableLogOnInfo logOnInfo = table.LogOnInfo;
if (logOnInfo != null)
{
logOnInfo.ConnectionInfo = crystalConnectionInfo;
table.LogOnInfo.TableName = table.Name;
table.LogOnInfo.ConnectionInfo.UserID = someConnectionInfo.UserID;
table.LogOnInfo.ConnectionInfo.Password = someConnectionInfo.Password;
table.LogOnInfo.ConnectionInfo.DatabaseName = someConnectionInfo.DatabaseName;
table.LogOnInfo.ConnectionInfo.ServerName = someConnectionInfo.ServerName;
table.ApplyLogOnInfo(table.LogOnInfo);
table.Location = someConnectionInfo.DatabaseName + ".dbo." + table.Name;
}
}
//call this method recursively for each subreport
foreach (ReportObject reportObject in report.ReportDefinition.ReportObjects)
{
if (reportObject.Kind == ReportObjectKind.SubreportObject)
{
this.FixDatabase(report.OpenSubreport(((SubreportObject)reportObject).SubreportName));
}
}
}