OpenSchema order

OpenSchema order

am 04.11.2007 14:55:02 von lantz

I am a bit new to this, I hope for some help
I am trying to load info of the columns from various database tables.

Set objRS = objConn.OpenSchema(adSchemaColumns,
Array(Empty,Empty,strTableName,Empty))

Now this works fine except the problem I have is that it loads the recordset
with info of the columns in alphabetic order.
Is it possible to load the info in the order the tables are created
Thanks Geoff

Re: OpenSchema order

am 04.11.2007 15:20:38 von reb01501

Geoff wrote:
> I am a bit new to this, I hope for some help
> I am trying to load info of the columns from various database tables.
>
> Set objRS = objConn.OpenSchema(adSchemaColumns,
> Array(Empty,Empty,strTableName,Empty))
>
> Now this works fine except the problem I have is that it loads the
> recordset with info of the columns in alphabetic order.
> Is it possible to load the info in the order the tables are created
> Thanks Geoff

I see no way for this to be done with OpenSchema.
Neither do I see a way for it to be accomplished with ADOX.
Depending on what database you are using, this information may be available
in a system table.
Opening a recordset using "select * from tablename where 1-2" MIGHT give you
a set of fields in the order you desire, but there is not guarantee that
this will work in all cases. You're pretty much at the mercy of whatever
data provider you are using.
--
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"

Re: OpenSchema order

am 05.11.2007 00:51:50 von lantz

"Bob Barrows [MVP]" wrote in message
news:eNjBN3uHIHA.4712@TK2MSFTNGP04.phx.gbl...
> I see no way for this to be done with OpenSchema.
> Neither do I see a way for it to be accomplished with ADOX.
> Depending on what database you are using, this information may be
available
> in a system table.
> Opening a recordset using "select * from tablename where 1-2" MIGHT give
you
> a set of fields in the order you desire, but there is not guarantee that
> this will work in all cases. You're pretty much at the mercy of whatever
> data provider you are using.
> --
> 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"
>

I am using Access+Jet
Thanks, I have managed to fix it by loading first the schema column items
data into a objCopyColumnDict
and then loading a recordset as you suggested ("Select * From " &
strTableName)
The recordset is in the order I want, so I can get column info items swapped
from objCopyColumnDict
in the order I want.

For Each objField in objRS.Fields
objColumnDict.Add (objField.Name,
objCopyColumnDict.Item(objField.Name) )
next
objCopyColumnDict. = nothing
objColumnDict. alls well

Thanks for your help Bob
Regards Geoff