-1

I have a problem about parent key and child key are identical when the report show it shows me this error!

I created a view on SQL Server 2008 and I'm getting data from it for a report.

This is my search code in a 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;

and this is my code for showing report:

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

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

How do I solve the problem?

Emma
  • 27,428
  • 11
  • 44
  • 69

1 Answers1

0

I just want to say I solved this problem. the problem wasn't in my cod I updated my Database I had deleted all the relation in that and it didn't get update in stimulsoft. that's why I get this error "Parent Key and ChildKey are identical"