Here is the solution for issue number 1) "Logon failed" using fox pro and crystal in c#
ReportDocument doc = new ReportDocument();
ParameterFields paramFields = new ParameterFields();
string[] sParamArr = null;
doc.Load(frmMainButton._initialParam.ReportLocation + @"\" + _reportName.ToLower());
foreach (CrystalDecisions.CrystalReports.Engine.Table table in doc.Database.Tables)
{
table.LogOnInfo.ConnectionInfo.ServerName = frmMainButton._initialParam.DBDataSource + @"\" + table.LogOnInfo.TableName.ToString() + ".DBF";
table.ApplyLogOnInfo(table.LogOnInfo);
}
try
{
doc.Refresh();
doc.VerifyDatabase();
}
catch (LogOnException engEx)
{
MessageBox.Show("Incorrect Logon Parameters. Check your user name and password.");
}
if (_parametersList.Count > 0)
{
foreach (string s in _parametersList)
{
sParamArr = s.Split('|');
ParameterField pField = new ParameterField();
pField.Name = sParamArr[0];
pField.ParameterFieldName = sParamArr[0];
ParameterDiscreteValue pDValue = new ParameterDiscreteValue();
pDValue.Value = sParamArr[1];
pField.CurrentValues.Add(pDValue);
pField.ReportParameterType = ParameterType.QueryParameter;
pField.IsOptionalPrompt = true;
pField.HasCurrentValue = true;
pField.EnableNullValue = true;
paramFields.Add(pField);
doc.SetParameterValue(sParamArr[0], sParamArr[1]);
}
_parametersList.Clear();
}
doc.Refresh();
crystalReportViewer.UseWaitCursor = true;
crystalReportViewer.ParameterFieldInfo = paramFields;
crystalReportViewer.ReportSource = doc;
crystalReportViewer.RefreshReport();
crystalReportViewer.UseWaitCursor = false;