Table not connected to the data
I am getting this error:
"Table is not connected to the data. Register the data using Report.RegisterData method."
I am working in c# VS 2008.
I am working entirely in XML using typed datasets;
This is the XML
<?xml version="1.0" encoding="utf-8"?>
<school>
<teacher>
<TeacherName>Thomas</TeacherName>
<pupils>
<pupil>
<Name>Tim</Name>
<TeacherName>Thomas</TeacherName>
</pupil>
<pupil>
<Name>Terry</Name>
<TeacherName>Thomas</TeacherName>
</pupil>
<pupil>
<Name>Thelia</Name>
<TeacherName>Thomas</TeacherName>
</pupil>
</pupils>
</teacher>
<teacher>
<TeacherName>Dillman</TeacherName>
<pupils>
<pupil>
<Name>Diggy</Name>
<TeacherName>Dillman</TeacherName>
</pupil>
<pupil>
<Name>Derrick</Name>
<TeacherName>Dillman</TeacherName>
</pupil>
<pupil>
<Name>Dora</Name>
<TeacherName>Dillman</TeacherName>
</pupil>
</pupils>
</teacher>
<teacher>
<TeacherName>Fredman</TeacherName>
<pupils>
<pupil>
<Name>Fanny</Name>
<TeacherName>Fredman</TeacherName>
</pupil>
<pupil>
<Name>Fern</Name>
<TeacherName>Fredman</TeacherName>
</pupil>
<pupil>
<Name>Fenwick</Name>
<TeacherName>Fredman</TeacherName>
</pupil>
</pupils>
</teacher>
</school>
I fill the Typed dataset as follows;
public Form1()
{
InitializeComponent();
School = new school(); //Typed dataset generated from xsd schema
Teachers = new school.teacherDataTable();
Pupils = new school.pupilDataTable();
School.ReadXml(@c:\FastreportStudy1\Study1\Study1\School31.xml);
Teachers.ReadXml(@c:\FastreportStudy1\Study1\Study1\School31.xml);
Pupils.ReadXml(@c:\FastreportStudy1\Study1\Study1\School31.xml);
}
So far so good, the data gets into the typed dataset.
I have created a report which includes the typed dataset, and I am able to drag and drop the fields onto the report.
but when I try to show the report as follows:
Report R1 = new Report();
R1.Load(@C:\FastreportStudy1\Data\Rep1.frx);
R1.RegisterData(School.Tables["Teacher"], "teacher");
R1.RegisterData(School.Tables["Pupil"], "pupil");
R1.Show();
I get the error "teacher: Table is not connected to the data. Register the data using Report.RegisterData method."
What am I doing wong? (Probably everything)
Anyone?
Paul
"Table is not connected to the data. Register the data using Report.RegisterData method."
I am working in c# VS 2008.
I am working entirely in XML using typed datasets;
This is the XML
<?xml version="1.0" encoding="utf-8"?>
<school>
<teacher>
<TeacherName>Thomas</TeacherName>
<pupils>
<pupil>
<Name>Tim</Name>
<TeacherName>Thomas</TeacherName>
</pupil>
<pupil>
<Name>Terry</Name>
<TeacherName>Thomas</TeacherName>
</pupil>
<pupil>
<Name>Thelia</Name>
<TeacherName>Thomas</TeacherName>
</pupil>
</pupils>
</teacher>
<teacher>
<TeacherName>Dillman</TeacherName>
<pupils>
<pupil>
<Name>Diggy</Name>
<TeacherName>Dillman</TeacherName>
</pupil>
<pupil>
<Name>Derrick</Name>
<TeacherName>Dillman</TeacherName>
</pupil>
<pupil>
<Name>Dora</Name>
<TeacherName>Dillman</TeacherName>
</pupil>
</pupils>
</teacher>
<teacher>
<TeacherName>Fredman</TeacherName>
<pupils>
<pupil>
<Name>Fanny</Name>
<TeacherName>Fredman</TeacherName>
</pupil>
<pupil>
<Name>Fern</Name>
<TeacherName>Fredman</TeacherName>
</pupil>
<pupil>
<Name>Fenwick</Name>
<TeacherName>Fredman</TeacherName>
</pupil>
</pupils>
</teacher>
</school>
I fill the Typed dataset as follows;
public Form1()
{
InitializeComponent();
School = new school(); //Typed dataset generated from xsd schema
Teachers = new school.teacherDataTable();
Pupils = new school.pupilDataTable();
School.ReadXml(@c:\FastreportStudy1\Study1\Study1\School31.xml);
Teachers.ReadXml(@c:\FastreportStudy1\Study1\Study1\School31.xml);
Pupils.ReadXml(@c:\FastreportStudy1\Study1\Study1\School31.xml);
}
So far so good, the data gets into the typed dataset.
I have created a report which includes the typed dataset, and I am able to drag and drop the fields onto the report.
but when I try to show the report as follows:
Report R1 = new Report();
R1.Load(@C:\FastreportStudy1\Data\Rep1.frx);
R1.RegisterData(School.Tables["Teacher"], "teacher");
R1.RegisterData(School.Tables["Pupil"], "pupil");
R1.Show();
I get the error "teacher: Table is not connected to the data. Register the data using Report.RegisterData method."
What am I doing wong? (Probably everything)
Anyone?
Paul
Comments
R1.Dictionary.Connections.Item(0).ConnectionString = <your connection string>;
i use XML as my datasource as well and the connection string looks like this: "XsdFile=;XmlFile=C:\MyData.xml"
I'm dealing with live data which I assume means that it is not fixed. My data changes all the time and I want to simply read a table from a Microsoft Access database and print it out.
To me the manual is confusing as it starts with creating a report then says if you are using "live data" then you need to do this but I would like to see one complete source file.
Sorry for such a newbie question.
Lyle