I don't work a lot in Crystal Reports. So, I can't tell you whether this is best practice or not. But, it does work.
private
void
AddDataBaseInformation(ReportDocument rpt)
{
try
{
foreach
(CrystalDecisions.CrystalReports.Engine.Table table
in
rpt.Database.Tables)
{
var credentials = table.LogOnInfo;
credentials.ConnectionInfo.ServerName =
"server name"
credentials.ConnectionInfo.DatabaseName =
"database name "
;
credentials.ConnectionInfo.UserID =
"sql user"
;
credentials.ConnectionInfo.Password =
"sql pwd"
;
credentials.ConnectionInfo.IntegratedSecurity =
false
;
table.ApplyLogOnInfo(logon);
}
}