Stimulsoft 中的 Parent Key 和 ChildKey 是相同的

Parent Key and ChildKey are identical in Stimulsoft

我有一个关于父键和子键相同的问题,当报告显示它向我显示这个错误时!

我在 SQL Server 2008 上创建了一个视图,我正在从中获取数据以生成报告。

这是我在 class 中的搜索代码:

string query = "Select * from vBarname1  where  username = @admin and  shozviat = @shozviat and id = @id";

SqlConnection connection = new SqlConnection(connectionString);

SqlCommand cmd = new SqlCommand(query, connection);
cmd.Parameters.Add(new SqlParameter("@admin", admin));
cmd.Parameters.Add(new SqlParameter("@shozviat", shozviat));
cmd.Parameters.Add(new SqlParameter("@id", id));

SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;

DataTable dt = new DataTable();
da.Fill(dt);

return dt;

这是我显示报告的代码:

StiReport report2 = new StiReport();
report2.Load("barname1.mrt");

report2.RegData("barname1", dgbarname1.DataSource);
report2.Show();
//dgbarame1 is a datagirdview 

我该如何解决这个问题?

我只想说我解决了这个问题。 问题不在我的 cod 我更新了我的数据库我已经删除了其中的所有关系并且它没有在 stimulsoft 中得到更新。这就是我收到此错误的原因 "Parent Key and ChildKey are identical"