Try Again: add column colB to a dataset and copy values from colA to ColB ?

Discussion in 'ASP .Net Web Controls' started by JDP@Work, Feb 19, 2005.

  1. JDP@Work

    JDP@Work Guest

    I have a single datagrid in a usercontrol for my web app. The usercontrol grid
    is used in some 10 pages, for viewing and selecting records, searching etc.....

    I want to enable date sorting, so I want to take my EventDate comlumn, "ondate"
    and copy it's contents to a "SortDate" column, however I would also like to
    change the format of the data.

    Ondate #02/18/2005#

    SortDate string or integer value 20050218

    (Will this sort as expected?)

    I've gottine this far...

    ds.tables(0).columns.Add("SortDate", gettype(string))

    But I'm stuck as to how to copy the ondate column and reformat as indicated
    above.

    TIA

    JeffP......
     
    JDP@Work, Feb 19, 2005
    #1
    1. Advertising

  2. JDP@Work

    JDP@Work Guest

    Found a simple solution, cast my date as date in my sProc.

    select cast(convert(varchar(10),mydate,110)as datetime)

    TTA

    JeffP....

    "JDP@Work" <> wrote in message
    news:%...
    > I have a single datagrid in a usercontrol for my web app. The usercontrol

    grid
    > is used in some 10 pages, for viewing and selecting records, searching

    etc.....
    >
    > I want to enable date sorting, so I want to take my EventDate comlumn,

    "ondate"
    > and copy it's contents to a "SortDate" column, however I would also like to
    > change the format of the data.
    >
    > Ondate #02/18/2005#
    >
    > SortDate string or integer value 20050218
    >
    > (Will this sort as expected?)
    >
    > I've gottine this far...
    >
    > ds.tables(0).columns.Add("SortDate", gettype(string))
    >
    > But I'm stuck as to how to copy the ondate column and reformat as indicated
    > above.
    >
    > TIA
    >
    > JeffP......
    >
    >
     
    JDP@Work, Feb 23, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    26
    Views:
    2,181
    Roland Pibinger
    Sep 1, 2006
  2. Replies:
    1
    Views:
    300
    =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=
    Apr 7, 2007
  3. Replies:
    1
    Views:
    628
    red floyd
    Apr 7, 2007
  4. =?Utf-8?B?QUo=?=

    When to TRY and not to TRY

    =?Utf-8?B?QUo=?=, Oct 16, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    346
    sloan
    Oct 17, 2007
  5. MRAB
    Replies:
    4
    Views:
    326
Loading...

Share This Page