473,669 Members | 2,432 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Multiple Key Relations


How do I create a relationship on muliple columns in an untyped dataset.

Why does this not work.

da.Fill(ds)
ds.Tables(0).Ta bleName = "DesignSumm ary"
ds.Tables(1).Ta bleName = "FormulaSummary "
ds.Tables(2).Ta bleName = "MaterialSummar y"
ds.Tables(3).Ta bleName = "ItemUsage"
ds.Tables(5).Ta bleName = "UsageSumma ry"
Dim dcDesignSummary Key As DataColumn() =
{ds.Tables(0).C olumns("WorkOrd erID"), ds.Tables(0).Co lumns("DesignID "),
ds.Tables(0).Co lumns("MachineC ode")}
Dim dcFormulaSummar yKey As DataColumn() =
{ds.Tables(1).C olumns("WorkOrd erID"), ds.Tables(1).Co lumns("DesignID "),
ds.Tables(1).Co lumns("MachineC ode")}
Dim dcMaterialSumma ryKey As DataColumn() =
{ds.Tables(2).C olumns("WorkOrd erID"), ds.Tables(2).Co lumns("DesignID "),
ds.Tables(2).Co lumns("MachineC ode")}
Dim dcItemUsageSumm aryKey As DataColumn() =
{ds.Tables(3).C olumns("WorkOrd erID"), ds.Tables(3).Co lumns("DesignID "),
ds.Tables(3).Co lumns("MachineC ode")}
ds.Relations.Ad d("DesignFormul aRelation", dcDesignSummary Key,
dcFormulaSummar yKey, False)
ds.Relations.Ad d("DesignMateri alRelation", dcDesignSummary Key,
dcMaterialSumma ryKey, False)
ds.Relations.Ad d("DesignItemUs eageRelation", dcDesignSummary Key,
dcItemUsageSumm aryKey, False)
Best Regards
Randy
Nov 21 '05 #1
1 5125
You may have better luck if you individually fill each table - I could
never get the "multi fill" thing to work to begin with.

the following worked for me with trees nested 3 nodes deep...

Dim sql As String
Dim DSRptSetup As DataSet

sql = ya
Dim DAReportNames As New SqlClient.SqlDa taAdapter(sql, SqlConn)

sql = yadd
Dim DAReportLineIte ms As New SqlClient.SqlDa taAdapter(sql,
SqlConn)

sql = yadda
Dim DALineItemAccou nts As New SqlClient.SqlDa taAdapter(sql,
SqlConn)

DSRptSetup = New DataSet

DAReportNames.F ill(DSRptSetup, "dtReportNames" )
DAReportLineIte ms.Fill(DSRptSe tup, "dtLineItem s")
DALineItemAccou nts.Fill(DSRptS etup, "dtLineItemAcco unts")
Dim dcLINEITEMSumma ryKey As DataColumn() =
{DSRptSetup.Tab les("dtLineItem s").Columns("rp tCntnt_id"),
DSRptSetup.Tabl es("dtLineItems ").Columns("rpt Names_id")}

Dim dcACCOUNTSummar yKey As DataColumn() =
{DSRptSetup.Tab les("dtLineItem Accounts").Colu mns("rptCntnt_i d"),
DSRptSetup.Tabl es("dtLineItemA ccounts").Colum ns("rptNames_id ")}

DSRptSetup.Rela tions.Add("RptT oLineItem",
DSRptSetup.Tabl es("dtReportNam es").Columns("r ptNames_id"),
DSRptSetup.Tabl es("dtLineItems ").Columns("rpt Names_id"))
DSRptSetup.Rela tions.Add("Line ItemToAccnts",
dcLINEITEMSumma ryKey, dcACCOUNTSummar yKey, False)
then fill trees...

Randy Fraser wrote:
How do I create a relationship on muliple columns in an untyped dataset.
Why does this not work.

da.Fill(ds)
ds.Tables(0).Ta bleName = "DesignSumm ary"
ds.Tables(1).Ta bleName = "FormulaSummary "
ds.Tables(2).Ta bleName = "MaterialSummar y"
ds.Tables(3).Ta bleName = "ItemUsage"
ds.Tables(5).Ta bleName = "UsageSumma ry"
Dim dcDesignSummary Key As DataColumn() =
{ds.Tables(0).C olumns("WorkOrd erID"), ds.Tables(0).Co lumns("DesignID "), ds.Tables(0).Co lumns("MachineC ode")}
Dim dcFormulaSummar yKey As DataColumn() =
{ds.Tables(1).C olumns("WorkOrd erID"), ds.Tables(1).Co lumns("DesignID "), ds.Tables(1).Co lumns("MachineC ode")}
Dim dcMaterialSumma ryKey As DataColumn() =
{ds.Tables(2).C olumns("WorkOrd erID"), ds.Tables(2).Co lumns("DesignID "), ds.Tables(2).Co lumns("MachineC ode")}
Dim dcItemUsageSumm aryKey As DataColumn() =
{ds.Tables(3).C olumns("WorkOrd erID"), ds.Tables(3).Co lumns("DesignID "), ds.Tables(3).Co lumns("MachineC ode")}
ds.Relations.Ad d("DesignFormul aRelation", dcDesignSummary Key, dcFormulaSummar yKey, False)
ds.Relations.Ad d("DesignMateri alRelation", dcDesignSummary Key, dcMaterialSumma ryKey, False)
ds.Relations.Ad d("DesignItemUs eageRelation", dcDesignSummary Key, dcItemUsageSumm aryKey, False)
Best Regards
Randy


Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1007
by: Raed Sawalha | last post by:
I have the following code where Build the relation on DataSet Schema I got the error that Child Has Multiple Tables DataTable LoData = new DataTable("LearningOutcomesDT"); DataTable LoDocData = new DataTable("LearningOutcomesDocDT"); da = new SqlDataAdapter(BuildSQLQuery(BookId,queryType.LOBook),oSql); da.Fill(LoData); ds.Tables.Add(LoData); da = new SqlDataAdapter(BuildSQLQuery(BookId,queryType.LODoc),oSql);
2
10648
by: suzanne shelton | last post by:
Help! I have two tables that i am wishing to join that involve a multiple field primary key on the primary table. Primary table: ScheduleHistory SID *PK Schedule *PK Secondary table: Transactions SID Schedule ...
1
1798
by: Jef De Rycke | last post by:
Hi access group, I have written code to create relations between tables according to a corresponding relations information table. At first I thought my code was not working properly because after running the code the relations don't show in the relations window. However when I enter data in an underlying table I get referential integrity error messages so the relations does actually exist. The created relations do show in the relations...
0
976
by: Ron | last post by:
I am trying to create a nested DataList with multiple subcategories listed under each primary category. Unfortunately, I end up with a bunch of multiple SubCategory values after iterating through the loop. My code is as follows: //**************************************************************** for(int i=0;i<=cat.Count-1;i++) {
1
5053
by: chris | last post by:
Hi there, I have a dataset with two tables. They both have two columns which are related (sort of a joined key). I know how to create one relation: ds.Relations.Add("myrelation", ds.Tables.Columns, ds.Tables.Columns);
8
10389
by: Jason L James | last post by:
Hi all, does anyone know if I can create a dataview from multiple datatables. My dataset is constructed from four separate tables and then the relationships are added that link the tables together. To make data entry easier I would like to combine selected columns from the four tables onto a single dataview that could be used as the datasource for a datagrid control. The distinct updates, insert ans delete
0
949
by: Eric Dahnke | last post by:
Dear List, We have a large project with three of the larger components (of the project) being the eventual creation of a Global Product DB and a Global Customer DB and a Global Dealer DB. Because of certain legacy issues, the schema has evolved to be one large application specific schema containing product, customer, and dealer tables. A better design would be three separate databases (and we can pull them apart easily enough), but...
4
4694
by: Matt Kruse | last post by:
While developing an internal IE6-only webapp, a discussion started about the 'best' way to apply classes to data tables across multiple pages. The two arguments were: 1. Apply a single class to each table. That class (possibly in combination with other classes on child elements) controls every part of the table - layout, colors, fonts, etc. Example: class="data" PROS: Easier to standardize, less specificity confusion, everything is...
11
3666
by: shriil | last post by:
Hi I have this database that calculates and stores the incentive amount earned by employees of a particular department. Each record is entered by entering the Date, Shift (morn, eve, or night) and the 'employee name'. There is another table which assigns an ID to the Shifts, i.e. 1,2 and 3 for morn, eve & night shifts respectively. From the mother table, the incentive is calculated datewise for each employee as per his shift duty. In...
0
8465
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8895
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8809
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
5682
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4206
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4386
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2797
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2032
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1788
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.