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?