Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / January 2006

Tip: Looking for answers? Try searching our database.

Code does nothing in .NET 2.0

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Marco Wolff - 23 Jan 2006 08:20 GMT
Hi,

i'm updating some sources from .NET 1.0 to .NET 2.0 and some very strange
things happen, for example:

DataSet1.Tables["Customers"].ChildRelations[0].ChildColumns[0] =
DataSet1.Tables["Orders"].Columns["test"];

In .NET 1.0 "DataSet1.Tables["Customers"].ChildRelations[0].ChildColumns[0]"
is always "Columns["test"]". But now, nothing happens, the ChildColumns (on
the left side) are always stays the same, no Exception nothing.

For me this is very critical stand, because nothing happens and no Exception
is throwing.

Please help.

Marco
Marco Wolff - 23 Jan 2006 09:44 GMT
You can reproduce this bug by your own, try this:

DataSet DataSet1 = new DataSet();
DataTable customers = new DataTable("Customers");
customers.Columns.Add("CustID");
DataSet1.Tables.Add(customers);

DataTable orders = new DataTable("Orders");
orders.Columns.Add("CustID");
orders.Columns.Add("test");
DataSet1.Tables.Add(orders);

// Get the DataColumn objects from two DataTable objects
// in a DataSet. Code to get the DataSet not shown here.
DataColumn parentColumn =
   DataSet1.Tables["Customers"].Columns["CustID"];
DataColumn childColumn =
   DataSet1.Tables["Orders"].Columns["CustID"];
// Create DataRelation.
DataRelation relCustOrder;
relCustOrder = new DataRelation("CustomersOrders", parentColumn,
childColumn, true);
// Add the relation to the DataSet.
DataSet1.Relations.Add(relCustOrder);

DataSet1.Tables["Customers"].ChildRelations[0].ChildColumns[0] =
DataSet1.Tables["Orders"].Columns["test"];

If you try this under .NET 1.0
DataSet1.Tables["Customers"].ChildRelations[0].ChildColumns[0] = "CustID"

In .NET 2.0 DataSet1.Tables["Customers"].ChildRelations[0].ChildColumns[0] =
"test"

Thanks

Marco

> Hi,
>
[quoted text clipped - 15 lines]
>
> Marco

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.