Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Re: ADO Field Order

    Douglas wrote on 05 apr 2004 in microsoft.public.inetserver.asp.db:
    > DAO has an OrdinalPosition property for the Fields collection, but how
    > about ADO ?
    A 4e generation relational database
    should not have an intrinsic field order.


    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
    Evertjan. Guest

  2. Similar Questions and Discussions

    1. Updating Sort Order on a field?
      Hi i have a customer table. i am displaying them in sorted order. but now i have added 1 field call SortID. now when ever if i add a new...
    2. SQL: Order by text & numbers in same field
      Hi I have a problem, don't think there's an easy solution but here goes: I have a db text field that contains text and numbers. I need to sort my...
    3. 'Order By' an 'as' field
      I have several working this way in my code: <cfquery name="GetSignups" datasource="Weddingsetgo"> select count(showcasesignups.userid) as...
    4. Acrobat 6 and Field Tab Order
      When I was using Acrobat 5, it was simple to define the tab order for fields. However, in version 6.0 I do not see any means of defining a custom tab...
    5. form field submit order
      Hello, Not sure if this is an asp or dreamweaver or a.n.other editor problem... I have a form with stacks of fields. This is submitted to a...
  3. #2

    Default Re: ADO Field Order

    Douglas wrote:
    > Sorry for the repost, I have had problems with my ISP(s) news
    > servers... I'm on my third news server and hopefully things have
    > improved :P... grr
    >
    > anyways...
    >
    > Gday,
    >
    > I need to retrieve a list of FieldNames from a table.
    >
    > I've done this successfully using ADOX.
    >
    > The question is, I want to arrange the fields in the same order that
    > they appear in the MDB, not alphabetically as ADOX returns.
    >
    As Evertjan says, there is no need to ever worry about the order of the
    fields in a relational database. The only reason you would ever need to
    worry about it is if you were planning to use selstar (select *) in
    production code, which is a bad practice. Always name the fields that your
    query will be returning. This will guarantee that the fields will be
    returned in the order that you expect.

    Bob Barrows

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"


    Bob Barrows Guest

  4. #3

    Default Re: ADO Field Order

    > A 4e generation relational database
    > should not have an intrinsic field order.

    Nevertheless, the fields are 'relatively' organised in the table design
    view. The aim here is to reduce development time :)

    MSAccess seems to remember the field order in the design view...

    I have written a little tool that connects to the specified DB, and I select
    a table from the list. Then I have a series of 'row templates' one of which
    I select. Then I pres the [Generate] button, and a the ASP/HTML <table> code
    is copied to the clipboard.

    This saves me a lot of time, however, the table rows <tr> always need
    reorganising which just about cancels out the time saved :(



    So the question is...

    Can I arrange the fields in the same order that they appear in the MDB, not
    alphabetically ?

    Thanks,
    -Douglas



    PS: What is '4e generation...' - is that 4th instead of 4e?






    Douglas Guest

  5. #4

    Default Re: ADO Field Order

    Douglas wrote:
    >
    > So the question is...
    >
    > Can I arrange the fields in the same order that they appear in the
    > MDB, not alphabetically ?
    >
    A better plan would be to allow your interface to specify the field order,
    and generate the select list so that the columns are selected in the proper
    order. Depending on the physical field order may work for a while, but will
    bite you in the @ss when you move to other database systems.

    Bob Barrows

    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.


    Bob Barrows [MVP] Guest

  6. #5

    Default Re: ADO Field Order

    Douglas wrote on 05 apr 2004 in microsoft.public.inetserver.asp.db:
    > PS: What is '4e generation...' - is that 4th instead of 4e?
    Not all have English as their first language.

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
    Evertjan. Guest

  7. #6

    Default Re: ADO Field Order

    Gday Evertjan,

    Sorry mate, wasnt being critical, just wanted to clarify :)

    Some poor souls only have english as their ONLY language ;)

    -Douglas

    "Evertjan." <exjxw.hannivoort@interxnl.net> wrote in message
    news:Xns94C29C1B7B251eejj99@194.109.133.29...
    > Douglas wrote on 05 apr 2004 in microsoft.public.inetserver.asp.db:
    > > PS: What is '4e generation...' - is that 4th instead of 4e?
    >
    > Not all have English as their first language.
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Please change the x'es to dots in my emailaddress)

    Douglas Guest

  8. #7

    Default Re: ADO Field Order


    "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
    news:uPsMSuwGEHA.3816@TK2MSFTNGP10.phx.gbl...
    > Douglas wrote:
    >
    > >
    > > So the question is...
    > >
    > > Can I arrange the fields in the same order that they appear in the
    > > MDB, not alphabetically ?
    > >
    > A better plan would be to allow your interface to specify the field order,

    ok...

    directly speaking, can it be done specifically using ado/adox ?

    > and generate the select list so that the columns are selected in the
    proper
    > order. Depending on the physical field order may work for a while, but
    will
    > bite you in the @ss when you move to other database systems.
    >
    > Bob Barrows
    >
    > --
    > Microsoft MVP -- ASP/ASP.NET
    > Please reply to the newsgroup. The email account listed in my From
    > header is my spam trap, so I don't check it very often. You will get a
    > quicker response by posting to the newsgroup.
    >
    >

    Douglas Guest

  9. #8

    Default Re: ADO Field Order

    Have you tried looking at the OpenSchema method on the ADO Connection Object? Look at the adSchemaColumns. There you will find
    ORDINAL_POSITION.

    --
    Al Reid

    "It ain't what you don't know that gets you into trouble. It's what you know
    for sure that just ain't so." --- Mark Twain

    "Douglas" <post.to.the.group@so.everyone.can.learn.com.au> wrote in message
    news:40716062$0$27648$61ce578d@news.syd.swiftdsl.c om.au...
    >
    > "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
    > news:uPsMSuwGEHA.3816@TK2MSFTNGP10.phx.gbl...
    > > Douglas wrote:
    > >
    > > >
    > > > So the question is...
    > > >
    > > > Can I arrange the fields in the same order that they appear in the
    > > > MDB, not alphabetically ?
    > > >
    > > A better plan would be to allow your interface to specify the field order,
    >
    >
    > ok...
    >
    > directly speaking, can it be done specifically using ado/adox ?
    >
    >
    > > and generate the select list so that the columns are selected in the
    > proper
    > > order. Depending on the physical field order may work for a while, but
    > will
    > > bite you in the @ss when you move to other database systems.
    > >
    > > Bob Barrows
    > >
    > > --
    > > Microsoft MVP -- ASP/ASP.NET
    > > Please reply to the newsgroup. The email account listed in my From
    > > header is my spam trap, so I don't check it very often. You will get a
    > > quicker response by posting to the newsgroup.
    > >
    > >
    >
    >

    Al Reid Guest

  10. #9

    Default Re: ADO Field Order

    Douglas wrote:
    > "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
    > news:uPsMSuwGEHA.3816@TK2MSFTNGP10.phx.gbl...
    >> Douglas wrote:
    >>
    >>>
    >>> So the question is...
    >>>
    >>> Can I arrange the fields in the same order that they appear in the
    >>> MDB, not alphabetically ?
    >>>
    >> A better plan would be to allow your interface to specify the field
    >> order,
    >
    >
    > ok...
    >
    > directly speaking, can it be done specifically using ado/adox ?
    >
    Yes it can:

    set rs=cn.OpenSchema(adSchemaColumns, _
    array(empty,empty,"Categories",empty))
    do until rs.eof
    Response.Write rs("COLUMN_NAME") & ": " & _
    rs("ORDINAL_POSITION") & "<BR>"
    rs.movenext
    loop
    rs.close:set rs=nothing
    cn.close:set cn=nothing

    But don't depend on it.

    Bob Barrows

    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.


    Bob Barrows [MVP] Guest

  11. #10

    Default Re: ADO Field Order


    "Al Reid" <areidjr@reidDASHhome.com> wrote in message
    news:OwA7kTxGEHA.3164@TK2MSFTNGP11.phx.gbl...
    > Have you tried looking at the OpenSchema method on the ADO Connection
    Object? Look at the adSchemaColumns. There you will find
    > ORDINAL_POSITION.
    >
    > --
    > Al Reid
    >
    > "It ain't what you don't know that gets you into trouble. It's what you
    know
    > for sure that just ain't so." --- Mark Twain

    Thanks very much Al, those two words was all i needed !


    Heres what I've got so far for anyone thats interested...


    Private Sub Command1_Click()

    Dim rsSchema As ADODB.Recordset
    Dim fld As ADODB.Field
    Dim rCriteria As Variant

    Dim cnn
    Set cnn = New ADODB.Connection

    With cnn
    .CursorLocation = adUseClient
    .Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=X:\your.mdb;"
    End With

    Set rsSchema = cnn.OpenSchema(adSchemaColumns, Array(Empty, Empty,
    "tblAddresses"))

    rsSchema.Sort = "ORDINAL_POSITION"

    Debug.Print "Fields according to Ordinal_Position:"

    While Not rsSchema.EOF
    Debug.Print rsSchema!COLUMN_NAME
    rsSchema.MoveNext
    Wend

    End Sub


    Douglas Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139