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






Comments

  • edited 3:17AM
    have you set the connection string?

    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"

  • edited 3:17AM
    I'm having the same problem Table Not Connected To The Data and cannot figure it out. By the previous posts I'm assuming that my variable names are not consistant but am unable to figure it out. Does anyone have a SIMPLE C# complete source file that they could email me so I can try to figure this out.

    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

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.