Creating Dataview limited to certain columns from datatable

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

    Creating Dataview limited to certain columns from datatable

    Normally Google is my friend, but I can't seem to work this one out. I'm
    sure it's really simple as well.

    I normally create a dataview from a table within a dataset using the
    ..defaultdatavi ew method of the table (eg dv=ds.tables(0) .defaultdatavie w)

    I want to create a dataview that is limited to only certain columns of the
    datatable.

    Anybody got a quick example to get me going?

    Thanks in advance
    Simon


  • Jim Underwood

    #2
    Re: Creating Dataview limited to certain columns from datatable

    Have you tried using the RowFilter method of the dataview to limit the data
    after the fact?

    "Simon Verona" <nomail@nomail. zzz> wrote in message
    news:OcN1in83FH A.3244@tk2msftn gp13.phx.gbl...[color=blue]
    > Normally Google is my friend, but I can't seem to work this one out. I'm
    > sure it's really simple as well.
    >
    > I normally create a dataview from a table within a dataset using the
    > .defaultdatavie w method of the table (eg dv=ds.tables(0) .defaultdatavie w)
    >
    > I want to create a dataview that is limited to only certain columns of the
    > datatable.
    >
    > Anybody got a quick example to get me going?
    >
    > Thanks in advance
    > Simon
    >
    >[/color]


    Comment

    • Chris

      #3
      Re: Creating Dataview limited to certain columns from datatable

      Simon Verona wrote:[color=blue]
      > Normally Google is my friend, but I can't seem to work this one out. I'm
      > sure it's really simple as well.
      >
      > I normally create a dataview from a table within a dataset using the
      > .defaultdatavie w method of the table (eg dv=ds.tables(0) .defaultdatavie w)
      >
      > I want to create a dataview that is limited to only certain columns of the
      > datatable.
      >
      > Anybody got a quick example to get me going?
      >
      > Thanks in advance
      > Simon
      >
      >[/color]

      I guess my question is why you want to do this?

      The dataview is just a filtered view of the table. It limits what rows
      you see. Whatever you are using to display the data (datagrid?) should
      be limiting the number of columns you see. The data is not copied when
      you use a dataview, it is still pointing to the same datatable and
      therefore needs the same structure.

      Chris

      Comment

      • Cor Ligthert [MVP]

        #4
        Re: Creating Dataview limited to certain columns from datatable

        Simon,

        It is as Chris write, however I have seen this question more, therefore I am
        curious why you ask this?

        (You can hide a column of a datatable with the columnmapping, however it is
        than for all dataviews)

        Cor


        Comment

        • Simon Verona

          #5
          Re: Creating Dataview limited to certain columns from datatable

          You are correct, I can alter the display using the datagrid that I'm using
          (it's actually Component One's truedbgrid that I'm using).

          Just was thinking that it might be easier and quicker to remove the column
          from the dataview that I'm creating - this is a view only grid so there will
          be no updating/deleting etc.

          I found the columnmapping property and I'm experimenting with that,
          otherwise I'll choose the columns on the datagrid itself.

          Thanks for the thoughts
          Simon
          "Cor Ligthert [MVP]" <notmyfirstname @planet.nl> wrote in message
          news:%239YYecE4 FHA.2552@TK2MSF TNGP10.phx.gbl. ..[color=blue]
          > Simon,
          >
          > It is as Chris write, however I have seen this question more, therefore I
          > am curious why you ask this?
          >
          > (You can hide a column of a datatable with the columnmapping, however it
          > is than for all dataviews)
          >
          > Cor
          >[/color]


          Comment

          Working...