How to retrieve database schema for use in IBindableTemplate.ExctractValues

Discussion in 'ASP .Net' started by fuchs.markus@gmail.com, Aug 8, 2005.

  1. Guest

    Hello all,
    I'm currently writing on a templated databound control.
    But for the control to work correctly I need to know the Datatype of
    the columns to which values in the template are bound.
    An example:

    markup in the template:
    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("BirthDate")
    %>'></asp:TextBox>

    Now, how can i determine if the column BirthDate is a string or a
    number or a date, etc..

    Thanks in advance
    Markus Fuchs

    (Sorry for my English, i'm not native)
    , Aug 8, 2005
    #1
    1. Advertising

  2. RE: How to retrieve database schema for use in IBindableTemplate.Exctr

    If this is SQL server, you can run an sp_help on the table. If this can be
    multiple types of database, I would consider using Interop with SQL DMO. With
    the 2.0 Framework and SQL Server 2005, you also have SMO as an option (future
    thoughts).

    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA

    ***************************
    Think Outside the Box!
    ***************************


    "" wrote:

    > Hello all,
    > I'm currently writing on a templated databound control.
    > But for the control to work correctly I need to know the Datatype of
    > the columns to which values in the template are bound.
    > An example:
    >
    > markup in the template:
    > <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("BirthDate")
    > %>'></asp:TextBox>
    >
    > Now, how can i determine if the column BirthDate is a string or a
    > number or a date, etc..
    >
    > Thanks in advance
    > Markus Fuchs
    >
    > (Sorry for my English, i'm not native)
    >
    >
    =?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN, Aug 8, 2005
    #2
    1. Advertising

  3. Brock Allen Guest

    You can do what the GridView does to build its columns. It, in essence, gets
    the first row then uses reflection to interogate the row for its properties.
    It does this in CreateChildControls. Where are you looking to do this in
    your code? Use reflector and check out CreateAutoGeneratedColumns on the
    GridView.

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen



    > Hello all,
    > I'm currently writing on a templated databound control.
    > But for the control to work correctly I need to know the Datatype of
    > the columns to which values in the template are bound.
    > An example:
    > markup in the template:
    > <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("BirthDate")
    > %>'></asp:TextBox>
    > Now, how can i determine if the column BirthDate is a string or a
    > number or a date, etc..
    >
    > Thanks in advance
    > Markus Fuchs
    > (Sorry for my English, i'm not native)
    >
    Brock Allen, Aug 8, 2005
    #3
  4. Guest

    Hi Allen,

    it works perfectly.

    Thank you very much.

    Markus
    , Aug 9, 2005
    #4
    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. =?Utf-8?B?VGltOjouLg==?=

    Retrieve value from database and use in another sub???

    =?Utf-8?B?VGltOjouLg==?=, Dec 16, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    414
    =?Utf-8?B?QnJpYW4gQnJvd24=?=
    Dec 16, 2004
  2. Markus
    Replies:
    1
    Views:
    1,495
    Markus
    Nov 23, 2005
  3. Stanimir Stamenkov
    Replies:
    3
    Views:
    1,169
    Stanimir Stamenkov
    Apr 25, 2005
  4. =?Utf-8?B?R2FuZXNoIE11dGh1dmVsdQ==?=

    IBindableTemplate : Help

    =?Utf-8?B?R2FuZXNoIE11dGh1dmVsdQ==?=, Aug 3, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    1,030
    Gozirra
    Aug 14, 2006
  5. Replies:
    0
    Views:
    291
Loading...

Share This Page