Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Relations (newbee trying to get it to work)
Message
 
To
All
General information
Forum:
ASP.NET
Category:
ADO.NET
Title:
Relations (newbee trying to get it to work)
Miscellaneous
Thread ID:
00906710
Message ID:
00906710
Views:
62
Hi,

I'm trying to set a relation between two tables and according to the Relations.Count I have one but it doesn't seems to work, I suspect it's probably in the display I'm missing something but I'm not sure, it might be somewhere else too as I'm really starting in .NET. I'm working with the Compact Framework since it's a PocketPC application.

So here is the code I have (oDS is a small wrapper class I have to load data in my DataSet - basically, XMLFileToDataSet use the ReadXML Method to add the specified XML file in the Tables collection) :

<
>
oDS.XMLFileToDataSet(Path.Combine(oUtils.GetAppPath(), "Workorders.xml"))
oDS.XMLFileToDataSet(Path.Combine(oUtils.GetAppPath(), "Assets.xml"))
oDS.oData.Relations.Add("assettowork", _
oDS.oData.Tables("assets").Columns("assetid"), _
oDS.oData.Tables("workorders").Columns("assetid"))

'Displays 1
MessageBox.Show(oDS.oData.Relations.Count.ToString())

'Bind the asset list to the assets ids
LstAssets.DataSource = oDS.oData.Tables("assets")
LstAssets.DisplayMember = "assetid"

'Bind the work orders listbox to workid
LstWO.DataSource = oDS.oData.Tables("workorders")
LstWO.DisplayMember = "workid"

'Bind the lable to show the description of the asset
LblAssetDesc.DataBindings.Add(New Binding("Text", oDS.oData.Tables("assets"), "asset_desc"))

'Bind the text box for entering works description
TxtWoDesc.DataBindings.Add(New Binding("Text", oDS.oData.Tables("workorders"), "work_desc"))
<
>

When I change of item in LstAssets it doesn't reflects anything of the relation, but both bindings works fine. Where did I miss ? In the display or something is missing in my relation ?

Any input appreciated. Thanks,
Sylvain Bujold
Next
Reply
Map
View

Click here to load this message in the networking platform