Click here to Skip to main content
15,892,298 members
Home / Discussions / C#
   

C#

 
GeneralResponse to e-mail sent directly from OP Pin
Keith Barrow7-Aug-10 9:36
professionalKeith Barrow7-Aug-10 9:36 
GeneralRe: Response to e-mail sent directly from OP Pin
karayel_kara10-Aug-10 17:56
karayel_kara10-Aug-10 17:56 
GeneralRe: Response to e-mail sent directly from OP Pin
Keith Barrow11-Aug-10 10:16
professionalKeith Barrow11-Aug-10 10:16 
GeneralRe: Response to e-mail sent directly from OP Pin
karayel_kara12-Aug-10 18:15
karayel_kara12-Aug-10 18:15 
GeneralRe: Response to e-mail sent directly from OP Pin
Keith Barrow12-Aug-10 23:12
professionalKeith Barrow12-Aug-10 23:12 
QuestionMasking in C# Pin
Pdaus2-Aug-10 18:28
Pdaus2-Aug-10 18:28 
AnswerRe: Masking in C# Pin
Pete O'Hanlon2-Aug-10 21:37
mvePete O'Hanlon2-Aug-10 21:37 
QuestionThis constraint cannot be enabled as not all values have corresponding parent values Pin
Vimalsoft(Pty) Ltd2-Aug-10 11:42
professionalVimalsoft(Pty) Ltd2-Aug-10 11:42 
Good Day All

i have a function that builds a Dataset from 3 Xml Files. Let me take this time to explain the xml files.

There is Subjects.xml, this xml contains all the subjects and i have XML_Venue.xml that contains all the venues and i have TimeTableFull.xml it contains the times,Venues that the subjects will be attended at. Now that means TimeTableFull.xml has many occurances of subjects but on Different venues or same venues but different times. The Following code builds a dataset from the xml's

private DataSet CreateDataSet()
   {
        DataColumn[] keys = new DataColumn[1];
        DataSet dsFinalTimeTable = new DataSet();
        DataTable tbldt;

        tbldt = new DataTable("Subjects");
        //Add Staff Table 
        XmlDataDocument xmlDatadocStaff = new XmlDataDocument();
        xmlDatadocStaff.DataSet.ReadXml(@"J:\Pilot Project\App_Data\Subjects.xml");
        tbldt = xmlDatadocStaff.DataSet.Tables["Subjects"];
        keys = new DataColumn[1];
        keys[0] = tbldt.Columns["ID"];
        tbldt.PrimaryKey = keys;
        dsFinalTimeTable.Tables.Add(tbldt.Copy());


        //Add Venue Table 
        tbldt = new DataTable("Venue");
        XmlDataDocument xmlDatadocVenue = new XmlDataDocument();
        xmlDatadocVenue.DataSet.ReadXml(@"J:\Pilot Project\App_Data\XML_Venue.xml");
        tbldt =  xmlDatadocVenue.DataSet.Tables["VENUE"];
        keys = new DataColumn[1];
        keys[0] = tbldt.Columns["ID"];
        tbldt.PrimaryKey = keys;
        
        dsFinalTimeTable.Tables.Add(tbldt.Copy());

       //TimeTable
        tbldt = new DataTable("TimeTable");
        XmlDataDocument xmlDatadocTimeTable = new XmlDataDocument();
        xmlDatadocTimeTable.DataSet.ReadXml(@"J:\Pilot Project\App_Data\TimeTableFull.xml");
        tbldt = xmlDatadocTimeTable.DataSet.Tables[0];
        keys = new DataColumn[1];
        keys[0] = tbldt.Columns["ID"];
        tbldt.PrimaryKey = keys; 
        dsFinalTimeTable.Tables.Add(tbldt.Copy());
        
        
        //Setup RelationsTimeTable//
        DataRelation VenuesRelations = new DataRelation("VenueRel", dsFinalTimeTable.Tables["Venue"].Columns["ID"], dsFinalTimeTable.Tables["Appointment"].Columns["ID"]);
        DataRelation ModuleRelations = new DataRelation("ModuleRel",dsFinalTimeTable.Tables["Subjects"].Columns["ID"],dsFinalTimeTable.Tables["Appointment"].Columns["subjectid"]);
       
        dsFinalTimeTable.Relations.Add(VenuesRelations);
        dsFinalTimeTable.Relations.Add(ModuleRelations);

        return dsFinalTimeTable;
   }


and my problems comes when i have have to add relations on the module relations

dsFinalTimeTable.Relations.Add(ModuleRelations);


i receive the Following error

This constraint cannot be enabled as not all values have corresponding parent values

and i tried to use this line of code to remove this integrity enforcement

dsFinalTimeTable.EnforceConstraints = false;


and this left me with an empty grid and this does not look correct.

Can someone assist me. i have attached the 3 xml files.

http://www.vbforums.com/attachment.php?attachmentid=79604&d=1280784905

http://www.vbforums.com/attachment.php?attachmentid=79605&d=1280784953

http://www.vbforums.com/attachment.php?attachmentid=79606&d=1280785001


Thanks
Vuyiswa Maseko,

Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.

C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/

AnswerRe: This constraint cannot be enabled as not all values have corresponding parent values Pin
Gopal.S2-Aug-10 17:14
Gopal.S2-Aug-10 17:14 
GeneralRe: This constraint cannot be enabled as not all values have corresponding parent values Pin
Vimalsoft(Pty) Ltd2-Aug-10 21:40
professionalVimalsoft(Pty) Ltd2-Aug-10 21:40 
QuestionChange (or disable) selection color of listview [SOLVED partially] Pin
sodevrom2-Aug-10 8:11
sodevrom2-Aug-10 8:11 
AnswerRe: Change (or disable) selection color of listview (not easy :( ) Pin
Eddy Vluggen2-Aug-10 8:23
professionalEddy Vluggen2-Aug-10 8:23 
GeneralRe: Change (or disable) selection color of listview (not easy :( ) Pin
sodevrom2-Aug-10 8:28
sodevrom2-Aug-10 8:28 
GeneralRe: Change (or disable) selection color of listview (not easy :( ) Pin
Eddy Vluggen2-Aug-10 8:47
professionalEddy Vluggen2-Aug-10 8:47 
AnswerRe: Change (or disable) selection color of listview (not easy :( ) Pin
Keith Barrow2-Aug-10 8:35
professionalKeith Barrow2-Aug-10 8:35 
GeneralRe: Change (or disable) selection color of listview (not easy :( ) Pin
sodevrom2-Aug-10 14:26
sodevrom2-Aug-10 14:26 
AnswerRe: Change (or disable) selection color of listview (not easy :( ) Pin
Ennis Ray Lynch, Jr.2-Aug-10 8:46
Ennis Ray Lynch, Jr.2-Aug-10 8:46 
GeneralRe: Change (or disable) selection color of listview (not easy :( ) Pin
sodevrom2-Aug-10 14:25
sodevrom2-Aug-10 14:25 
AnswerRe: Change (or disable) selection color of listview (not easy :( ) Pin
William Winner2-Aug-10 12:32
William Winner2-Aug-10 12:32 
GeneralRe: Change (or disable) selection color of listview (not easy :( ) Pin
sodevrom2-Aug-10 14:24
sodevrom2-Aug-10 14:24 
GeneralRe: Change (or disable) selection color of listview (not easy :( ) Pin
sodevrom2-Aug-10 15:01
sodevrom2-Aug-10 15:01 
AnswerRe: Change (or disable) selection color of listview [SOLVED partially] Pin
V.3-Aug-10 0:08
professionalV.3-Aug-10 0:08 
Questionwhy the form with linkLabel can not get the [Enter] key down event Pin
yu-jian2-Aug-10 7:43
yu-jian2-Aug-10 7:43 
AnswerRe: why the form with linkLabel can not get the [Enter] key down event Pin
I Believe In GOD2-Aug-10 8:01
I Believe In GOD2-Aug-10 8:01 
Questionhelp with import data from csv to access - problem with the (") character Pin
Gali19782-Aug-10 4:11
Gali19782-Aug-10 4:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.