S
Steve
Hi-
I'm still trying to put DataRelations to good and proper use on our site.
So far I'm having a hard time. Here is my situation:
Tbl_Products
[ id ]
Tbl_Prod_Faqs (many to many)
[ prodid ] [ faqid ]
Tbl_Faqs
[ faqid ] [ question ] [ answer ]
so, I want to get all the faqs for a given product or better yet, bind a
DataList to the Tbl_Products then a nested DataGrid and use "GetChildRows()"
to get the faq data
Tbl_Prod_Faqs is my many-to-many table where I relate the FAQs to their
respective Products
What is the correct way to setup DataRelation objects so that I can use this
data in a way that is best? So far I've managed to accomplish this:
DataRelation relFaq2Prod = new DataRelation("relFaq2Prod",
ds.Tables["Tbl_Products"].Columns["id"],
ds.Tables["Tbl_Products"].Columns["id"]);
DataSet dsFaq = NSDal.CNSDal.GetSupportFaqs2();
DataRow[] rows =
dsFaq.Tables["Tbl_Products"].Rows[0].GetChildRows(dsFaq.Relations[0]);
I can then bind the rows DataRow array to the DataGrid(which it doesn't like
at all, shows me "Has Errors")
I'm not seeing how I can utilize DataRelations to get what I need?
Hopefully someone will be able to make sense of this.
Thanks for reading,
Steve
I'm still trying to put DataRelations to good and proper use on our site.
So far I'm having a hard time. Here is my situation:
Tbl_Products
[ id ]
Tbl_Prod_Faqs (many to many)
[ prodid ] [ faqid ]
Tbl_Faqs
[ faqid ] [ question ] [ answer ]
so, I want to get all the faqs for a given product or better yet, bind a
DataList to the Tbl_Products then a nested DataGrid and use "GetChildRows()"
to get the faq data
Tbl_Prod_Faqs is my many-to-many table where I relate the FAQs to their
respective Products
What is the correct way to setup DataRelation objects so that I can use this
data in a way that is best? So far I've managed to accomplish this:
DataRelation relFaq2Prod = new DataRelation("relFaq2Prod",
ds.Tables["Tbl_Products"].Columns["id"],
ds.Tables["Tbl_Products"].Columns["id"]);
DataSet dsFaq = NSDal.CNSDal.GetSupportFaqs2();
DataRow[] rows =
dsFaq.Tables["Tbl_Products"].Rows[0].GetChildRows(dsFaq.Relations[0]);
I can then bind the rows DataRow array to the DataGrid(which it doesn't like
at all, shows me "Has Errors")
I'm not seeing how I can utilize DataRelations to get what I need?
Hopefully someone will be able to make sense of this.
Thanks for reading,
Steve