Generating a dataview from a datatable

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John

    Generating a dataview from a datatable

    Hi

    I have a strongly typed dataset generated by vs 2008. I am trying to fill in
    one of the datatables in the dataset and then cerate a dataview from the
    datatable. I have used the below code but it does not work.

    Public ds As MyDS
    Public dv As DataView
    Public daMyTbl As MyDSTableAdapte rs.MyTblTableAd apter

    ds.MyTbl.Clear( )
    daMyTbl.Fill(ds .MyTbl)

    dv = New DataView(ds.MyT bl)

    For starters it givbes 'Object reference not set to an instance of an
    object.' error on ds.MyTbl.Clear( ) line. What am I doing wrong?

    Many Thanks

    Regards


  • Steve Gerrard

    #2
    Re: Generating a dataview from a datatable

    John wrote:
    Hi
    >
    I have a strongly typed dataset generated by vs 2008. I am trying to
    fill in one of the datatables in the dataset and then cerate a
    dataview from the datatable. I have used the below code but it does
    not work.
    Public ds As MyDS
    Public dv As DataView
    Public daMyTbl As MyDSTableAdapte rs.MyTblTableAd apter
    >
    ds.MyTbl.Clear( )
    daMyTbl.Fill(ds .MyTbl)
    >
    dv = New DataView(ds.MyT bl)
    >
    For starters it givbes 'Object reference not set to an instance of an
    object.' error on ds.MyTbl.Clear( ) line. What am I doing wrong?
    >
    Many Thanks
    >
    Regards
    As with any object, you need
    ds = New MyDS

    You'll probably want one for daMyTbl as well.


    Comment

    • Cor Ligthert[MVP]

      #3
      Re: Generating a dataview from a datatable

      You'll probably want one for daMyTbl as well.
      >
      No that is in the new strongly typed dataset

      Cor

      Comment

      Working...