Dear experts, I am facing a wierd problem. I am using .NET 2003 and Crystal that comes bundled with it.
I have to create a report with fields from three related tables -
DM_Company (CompanyID char(5), CompanyName (varchar(35));
DT_TRIGGER (UserID char(5), TCode Numeric(12), Active char(1));
DT_USER (UserID char(5), CompanyID char(5)).
I require to display TCode Grouped By CompanyName and display User Details for the same.
I have created a .xsd Schema file with these three tables and appropriate relations. I am creating a DataSet with these three tables as follows:
strSQL = "Select a.CompanyName, b.TCode, c.UserID From ... etc"
'Create a Connection, command object. Open the connection and finally call the DataAdapter.Fill method.
Since I have three tables I am calling the DataAdapter.Fill method thrice for each table.
On the report, I am using the table definitions from the xsd file to display three fields UserID, CompanyName and Active. I have entered three trial records. When I check the number of records being returned by my data set using ds.Tables[0].Rows.Count everything seems fine - I get three records. However, my report shows me 9 records .. possibly three records each corresponding to the three tables.
I have set a relation for the xsd, I am using the appropriate sql to build my data set. I've also tried to add a relation into the dataset. However, the relations give an error .. as the parent child tables have a one-many relationship. It is allowing the relations only for a 1-1 type relationship. I am at my wits end .. can anyone help?? Thanks in advance
Start Free Trial