Home All Groups Group Topic Archive Search About

Datarows without datatables ?????

Author
5 Nov 2005 8:37 AM
Al Christoph
have the need for a data structure to have the clone / copy / independent
hunk of memory with the original values (take your choice) of a row in a
datatable. I don't see a data.datarow.clone or data.datarow.copy NOR a way of
creating the row in the absense of the table.

Can rows have existence independent of a table? The structure needs the data
from a specific row in a table. It needs to be able to modify that data, etc
without touching the original table. It only needs one row and not a table.
Hence my question:

Can a row have a life of its own without being in a table?????

Here is what I have resorted to doing:
    Public Property Shock() As Global.SimUser.dsShock.ShockRow
        Get
            Return Me.m_shockTable.Rows(0)
        End Get
        Set(ByVal value As Global.SimUser.dsShock.ShockRow)
            Me.m_shockTable.Clear()
            Me.m_shockTable.ImportRow(value)
        End Set
    End Property

what I'd like to be able to do is

Here is what I have resorted to doing:
    Public Property Shock() As Global.SimUser.dsShock.ShockRow
        Get
            Return Me.m_shock        End Get
        Set(ByVal value As Global.SimUser.dsShock.ShockRow)
            Me.m_shock = value.clone
        End Set
    End Property

Regards,
Al Christoph
Senior Consultant and Proprietor
Three Bears Software, LLC
just right software @ just right prices  @3bears.biz

Author
5 Nov 2005 8:47 AM
Cor Ligthert [MVP]
Al,

A datarow cannot have an existence without a reference to a datatable (it
can be detached from it, however it keeps the reference). Probably the main
reason for that is, that the information about the items in a datarow is not
in the datarow, however in the columncollection from the datatable.

You can however clone a datatable and importdatarow s from the original and
you can copy a complete datatable.

I hope that this gives an idea.

Cor
Author
5 Nov 2005 8:51 AM
Sahil Malik [MVP]
Since the structure of the row is dictated by the underlying columns in a
table - no it cannot exist completely independent of a datatable. The best
you can do is, use the DataTable.NewRow method to create a row with RowState
= Detached.

- Sahil Malik [MVP]
ADO.NET 2.0 book -
http://codebetter.com/blogs/sahil.malik/archive/2005/05/13/63199.aspx
----------------------------------------------------------------------------

Show quote
"Al Christoph" <AlFrom3BearsSoftware@newsgroups.nospam> wrote in message
news:94FC3624-ABAF-45A8-A38A-274694F995A5@microsoft.com...
> have the need for a data structure to have the clone / copy / independent
> hunk of memory with the original values (take your choice) of a row in a
> datatable. I don't see a data.datarow.clone or data.datarow.copy NOR a way
> of
> creating the row in the absense of the table.
>
> Can rows have existence independent of a table? The structure needs the
> data
> from a specific row in a table. It needs to be able to modify that data,
> etc
> without touching the original table. It only needs one row and not a
> table.
> Hence my question:
>
> Can a row have a life of its own without being in a table?????
>
> Here is what I have resorted to doing:
>    Public Property Shock() As Global.SimUser.dsShock.ShockRow
>        Get
>            Return Me.m_shockTable.Rows(0)
>        End Get
>        Set(ByVal value As Global.SimUser.dsShock.ShockRow)
>            Me.m_shockTable.Clear()
>            Me.m_shockTable.ImportRow(value)
>        End Set
>    End Property
>
> what I'd like to be able to do is
>
> Here is what I have resorted to doing:
>    Public Property Shock() As Global.SimUser.dsShock.ShockRow
>        Get
>            Return Me.m_shock        End Get
>        Set(ByVal value As Global.SimUser.dsShock.ShockRow)
>            Me.m_shock = value.clone
>        End Set
>    End Property
>
> Regards,
> Al Christoph
> Senior Consultant and Proprietor
> Three Bears Software, LLC
> just right software @ just right prices  @3bears.biz
Author
5 Nov 2005 12:41 PM
Al Christoph
That works perfectly for me! The row state of detached, that is. THANKS for
the response. It will simplify my code.

Regards,
Al Christoph
Senior Consultant and Proprietor
Three Bears Software, LLC
just right software @ just right prices  @3bears.biz


Show quote
"Sahil Malik [MVP]" wrote:

> Since the structure of the row is dictated by the underlying columns in a
> table - no it cannot exist completely independent of a datatable. The best
> you can do is, use the DataTable.NewRow method to create a row with RowState
> = Detached.
>
> - Sahil Malik [MVP]
> ADO.NET 2.0 book -
> http://codebetter.com/blogs/sahil.malik/archive/2005/05/13/63199.aspx
> ----------------------------------------------------------------------------
>
> "Al Christoph" <AlFrom3BearsSoftware@newsgroups.nospam> wrote in message
> news:94FC3624-ABAF-45A8-A38A-274694F995A5@microsoft.com...
> > have the need for a data structure to have the clone / copy / independent
> > hunk of memory with the original values (take your choice) of a row in a
> > datatable. I don't see a data.datarow.clone or data.datarow.copy NOR a way
> > of
> > creating the row in the absense of the table.
> >
> > Can rows have existence independent of a table? The structure needs the
> > data
> > from a specific row in a table. It needs to be able to modify that data,
> > etc
> > without touching the original table. It only needs one row and not a
> > table.
> > Hence my question:
> >
> > Can a row have a life of its own without being in a table?????
> >
> > Here is what I have resorted to doing:
> >    Public Property Shock() As Global.SimUser.dsShock.ShockRow
> >        Get
> >            Return Me.m_shockTable.Rows(0)
> >        End Get
> >        Set(ByVal value As Global.SimUser.dsShock.ShockRow)
> >            Me.m_shockTable.Clear()
> >            Me.m_shockTable.ImportRow(value)
> >        End Set
> >    End Property
> >
> > what I'd like to be able to do is
> >
> > Here is what I have resorted to doing:
> >    Public Property Shock() As Global.SimUser.dsShock.ShockRow
> >        Get
> >            Return Me.m_shock        End Get
> >        Set(ByVal value As Global.SimUser.dsShock.ShockRow)
> >            Me.m_shock = value.clone
> >        End Set
> >    End Property
> >
> > Regards,
> > Al Christoph
> > Senior Consultant and Proprietor
> > Three Bears Software, LLC
> > just right software @ just right prices  @3bears.biz
>
>
>
Author
5 Nov 2005 3:42 PM
Sahil Malik [MVP]
You're welcome :)

- Sahil Malik [MVP]
ADO.NET 2.0 book -
http://codebetter.com/blogs/sahil.malik/archive/2005/05/13/63199.aspx
----------------------------------------------------------------------------

Show quote
"Al Christoph" <AlFrom3BearsSoftware@newsgroups.nospam> wrote in message
news:C99D61BF-BA2A-4522-B977-8CCA9F7BEE86@microsoft.com...
> That works perfectly for me! The row state of detached, that is. THANKS
> for
> the response. It will simplify my code.
>
> Regards,
> Al Christoph
> Senior Consultant and Proprietor
> Three Bears Software, LLC
> just right software @ just right prices  @3bears.biz
>
>
> "Sahil Malik [MVP]" wrote:
>
>> Since the structure of the row is dictated by the underlying columns in a
>> table - no it cannot exist completely independent of a datatable. The
>> best
>> you can do is, use the DataTable.NewRow method to create a row with
>> RowState
>> = Detached.
>>
>> - Sahil Malik [MVP]
>> ADO.NET 2.0 book -
>> http://codebetter.com/blogs/sahil.malik/archive/2005/05/13/63199.aspx
>> ----------------------------------------------------------------------------
>>
>> "Al Christoph" <AlFrom3BearsSoftware@newsgroups.nospam> wrote in message
>> news:94FC3624-ABAF-45A8-A38A-274694F995A5@microsoft.com...
>> > have the need for a data structure to have the clone / copy /
>> > independent
>> > hunk of memory with the original values (take your choice) of a row in
>> > a
>> > datatable. I don't see a data.datarow.clone or data.datarow.copy NOR a
>> > way
>> > of
>> > creating the row in the absense of the table.
>> >
>> > Can rows have existence independent of a table? The structure needs the
>> > data
>> > from a specific row in a table. It needs to be able to modify that
>> > data,
>> > etc
>> > without touching the original table. It only needs one row and not a
>> > table.
>> > Hence my question:
>> >
>> > Can a row have a life of its own without being in a table?????
>> >
>> > Here is what I have resorted to doing:
>> >    Public Property Shock() As Global.SimUser.dsShock.ShockRow
>> >        Get
>> >            Return Me.m_shockTable.Rows(0)
>> >        End Get
>> >        Set(ByVal value As Global.SimUser.dsShock.ShockRow)
>> >            Me.m_shockTable.Clear()
>> >            Me.m_shockTable.ImportRow(value)
>> >        End Set
>> >    End Property
>> >
>> > what I'd like to be able to do is
>> >
>> > Here is what I have resorted to doing:
>> >    Public Property Shock() As Global.SimUser.dsShock.ShockRow
>> >        Get
>> >            Return Me.m_shock        End Get
>> >        Set(ByVal value As Global.SimUser.dsShock.ShockRow)
>> >            Me.m_shock = value.clone
>> >        End Set
>> >    End Property
>> >
>> > Regards,
>> > Al Christoph
>> > Senior Consultant and Proprietor
>> > Three Bears Software, LLC
>> > just right software @ just right prices  @3bears.biz
>>
>>
>>

AddThis Social Bookmark Button