Hi Henk,
What was the SQL before you added the table?
I reformatted your code but you may want to confirms it correct or simply copy it into Notepad and then paste into this post.
I find the easiest way to confirm is ad the table and joins in CR Designer first and then look at what Debug mode returns using this:
btnReportObjects.Text = "";
string crJoinOperator = "";
foreach (CrystalDecisions.ReportAppServer.DataDefModel.TableLink rasTableLink in rptClientDoc.DataDefController.Database.TableLinks)
{
//get the link properties
btnCount.Text = "";
int y = rptClientDoc.DataDefController.Database.TableLinks.Count;
btnCount.Text = y.ToString();
string crJoinType = "";
if (rasTableLink.JoinType == CrTableJoinTypeEnum.crTableJoinTypeAdvance)
{
crJoinType = "-> Advanced ->";
}
if (rasTableLink.JoinType == CrTableJoinTypeEnum.crTableJoinTypeEqualJoin)
{
crJoinType = "-> = ->";
}
if (rasTableLink.JoinType == CrTableJoinTypeEnum.crTableJoinTypeGreaterOrEqualJoin)
{
crJoinType = "-> >= ->";
}
if (rasTableLink.JoinType == CrTableJoinTypeEnum.crTableJoinTypeGreaterThanJoin)
{
crJoinType = "-> > ->";
}
if (rasTableLink.JoinType == CrTableJoinTypeEnum.crTableJoinTypeLeftOuterJoin)
{
crJoinType = "-> LOJ ->";
}
if (rasTableLink.JoinType == CrTableJoinTypeEnum.crTableJoinTypeLessOrEqualJoin)
{
crJoinType = "-> <= ->";
}
if (rasTableLink.JoinType == CrTableJoinTypeEnum.crTableJoinTypeLessThanJoin)
{
crJoinType = "-> < ->";
}
if (rasTableLink.JoinType == CrTableJoinTypeEnum.crTableJoinTypeNotEqualJoin)
{
crJoinType = "-> != ->";
}
if (rasTableLink.JoinType == CrTableJoinTypeEnum.crTableJoinTypeOuterJoin)
{
crJoinType = "-> OJ ->";
}
if (rasTableLink.JoinType == CrTableJoinTypeEnum.crTableJoinTypeRightOuterJoin)
{
crJoinType = "-> ROJ ->";
}
textBox1 = "Only gets Link type:" + rasTableLink.SourceTableAlias.ToString() + "." + rasTableLink.SourceFieldNames[0].ToString() +
crJoinOperator + "." + crJoinType + rasTableLink.TargetTableAlias.ToString() + "." + rasTableLink.TargetFieldNames[0].ToString() + "\n";
btnReportObjects.Text += textBox1;
btnReportObjects.AppendText(" 'End' \n");
}
There are some join types RAS is not capable of.
Attach the report before and after you manually add the join and I'll see if I can get it to work also.
Don
( PS - use the Advanced option to attach files and rename the reports to *.txt. )