|
 |
ado_dotnet thread: Re: DataRelation (multiple)
Message #1 by "Alex Homer" <alex@s...> on Sat, 14 Dec 2002 01:05:31 -0000
|
|
Your code looks fine (the same as the SDK example). Are you sure there are
these two tables in the DataSet? Which line is the error occurring on (turn
on Debug="True" in the @Page directive).
"Andy" <andrecourcy@h...> wrote in message news:225310@a..._dotnet...
>
> I want to make relation between 2 tables from dataset. I try this code but
> i received this msg: Object reference not set to an instance of an object.
> How i can do make this relation
>
> Dim parentCols() As DataColumn
> Dim childCols() As DataColumn
>
> parentCols(0) = dsSql.Tables("SIG00200").Columns("ProjetID")
> parentCols(1) = dsSql.Tables("SIG00200").Columns("SubLevel1")
> parentCols(2) = dsSql.Tables("SIG00200").Columns("SubLevel2")
>
> childCols(0) = dsSql.Tables("SIG00300").Columns("ProjetID")
> childCols(1) = dsSql.Tables("SIG00300").Columns("SubLevel1")
> childCols(2) = dsSql.Tables("SIG00300").Columns("SubLevel2")
>
> Dim bContraint As Boolean = True
> Dim ProjetRel As DataRelation = New DataRelation("xyz",
> parentCols, childCols, bContraint)
>
> dsSql.Relations.Add(ProjetRel)
>
> Andy
>
>
Message #2 by "Dumais, Mike" <mike.dumais@D...> on Fri, 13 Dec 2002 20:34:25 -0500
|
|
Try using the New keyword to instantiate your objects (See below)
Dim parentCols() As New DataColumn
Dim childCols() As New DataColumn
-----Original Message-----
From: Alex Homer [mailto:alex@s...]
Sent: Friday, December 13, 2002 8:06 PM
To: ADO.NET
Subject: [ado_dotnet] Re: DataRelation (multiple)
Your code looks fine (the same as the SDK example). Are you sure there are
these two tables in the DataSet? Which line is the error occurring on (turn
on Debug="True" in the @Page directive).
"Andy" <andrecourcy@h...> wrote in message news:225310@a..._dotnet...
>
> I want to make relation between 2 tables from dataset. I try this code but
> i received this msg: Object reference not set to an instance of an object.
> How i can do make this relation
>
> Dim parentCols() As DataColumn
> Dim childCols() As DataColumn
>
> parentCols(0) = dsSql.Tables("SIG00200").Columns("ProjetID")
> parentCols(1) = dsSql.Tables("SIG00200").Columns("SubLevel1")
> parentCols(2) = dsSql.Tables("SIG00200").Columns("SubLevel2")
>
> childCols(0) = dsSql.Tables("SIG00300").Columns("ProjetID")
> childCols(1) = dsSql.Tables("SIG00300").Columns("SubLevel1")
> childCols(2) = dsSql.Tables("SIG00300").Columns("SubLevel2")
>
> Dim bContraint As Boolean = True
> Dim ProjetRel As DataRelation = New DataRelation("xyz",
> parentCols, childCols, bContraint)
>
> dsSql.Relations.Add(ProjetRel)
>
> Andy
>
>
===
Fast Track ADO.NET with C# is a concise introduction to the concepts,
techniques, and libraries that you will need in order to start using ADO.NET
in your applications. The book covers DataSets and Typed DataSets, accessing
data using DataReaders and DataAdaptors, the close relationship between
ADO.NET and XML, how and where to use ADO.NET in your enterprise
applications, and how to use Web Services and ADO.NET to easily pass data
between applications.
http://www.wrox.com/books/1861007604.htm
Confidentiality Notice: This e-mail message, including any attachments, is
for the sole use of the recipient(s) and may contain confidential and
privileged information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the intended recipient, please
contact the sender by reply e-mail and destroy all copies of the original
message.
|
|
 |