|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Fields in Access database returned in alphabetical orderI'm using the following VB.Net code to retreive the field names of a table
in an Access db: Dim NewField As ADOX.Column Dim tblField As ADOX.Column For Each tblField In adocat.Tables("tblData").Columns The fields are returned in alphabetical order! I want to have the fields returned in the order they were created. Can this be done? -Julian
Show quote
Hide quote
"Julian" <ad***@jdmils.com> schrieb It is not available in ADOX. Use DAO for native Jet support. See the > I'm using the following VB.Net code to retreive the field names of a > table in an Access db: > > Dim NewField As ADOX.Column > Dim tblField As ADOX.Column > > For Each tblField In adocat.Tables("tblData").Columns > > > The fields are returned in alphabetical order! I want to have the > fields returned in the order they were created. Can this be done? > > -Julian Ordinalposition property of the Field object. The DAO docu also says that two fields can have the same ordinal position. More information: http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/office97/html/output/F1/D2/S5A2D1.asp Armin How do you use DAO in VB.Net?
-- Show quoteHide quote| +-- Julian | "Armin Zingler" <az.nospam@freenet.de> wrote in message news:e7k1tzTRGHA.2300@TK2MSFTNGP11.phx.gbl... > "Julian" <ad***@jdmils.com> schrieb >> I'm using the following VB.Net code to retreive the field names of a >> table in an Access db: >> >> Dim NewField As ADOX.Column >> Dim tblField As ADOX.Column >> >> For Each tblField In adocat.Tables("tblData").Columns >> >> >> The fields are returned in alphabetical order! I want to have the >> fields returned in the order they were created. Can this be done? >> >> -Julian > > > > It is not available in ADOX. Use DAO for native Jet support. See the > Ordinalposition property of the Field object. The DAO docu also says that > two fields can have the same ordinal position. More information: > http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/office97/html/output/F1/D2/S5A2D1.asp > > > Armin "Julian" <ad***@jdmils.com> schrieb Set a reference to "Microsoft Data Access Objects". But you should probably> How do you use DAO in VB.Net? better have a look at Chris' answer. See also: System.Data.OleDb.OleDbConnection.GetOleDbSchemaTable and http://msdn.microsoft.com/library/en-us/oledb/htm/oledbcolumns_rowset.asp Column "ORDINAL_POSITION" http://msdn.microsoft.com/library/en-us/oledb/htm/oledbprovjet_overview.asp especially http://msdn.microsoft.com/library/en-us/oledb/htm/oledbprovjet_supported_schema_rowsets.asp Armin Armin Zingler wrote:
Show quoteHide quote > "Julian" <ad***@jdmils.com> schrieb You can get it in ADO which is the .net way of doing things. There is a > >> I'm using the following VB.Net code to retreive the field names of a >> table in an Access db: >> >> Dim NewField As ADOX.Column >> Dim tblField As ADOX.Column >> >> For Each tblField In adocat.Tables("tblData").Columns >> >> >> The fields are returned in alphabetical order! I want to have the >> fields returned in the order they were created. Can this be done? >> >> -Julian > > > > > It is not available in ADOX. Use DAO for native Jet support. See the > Ordinalposition property of the Field object. The DAO docu also says > that two fields can have the same ordinal position. More information: > http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/office97/html/output/F1/D2/S5A2D1.asp > > > > Armin function on the connection or command object called gettableschema that will get you the info you want. Chris
Show quote
Hide quote
"Chris" <no@spam.com> schrieb I thought ADOX is even closer to DAO than ADO.Net. Therefore I did> > It is not available in ADOX. Use DAO for native Jet support. See > > the Ordinalposition property of the Field object. The DAO docu > > also says that two fields can have the same ordinal position. More > > information: > > http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/office97/html/output/F1/D2/S5A2D1.asp > > > > > > > > Armin > > You can get it in ADO which is the .net way of doing things. There > is a function on the connection or command object called > gettableschema that will get you the info you want. not even think of doing it in ADO.Net. But your probably right. Armin
[VB.NET] How to store/load XML schema internally...
Passing values bewteen user controls is separate web forms datagridview combo box latency when loading forms Coding a TimeSpan Best way to implement 2 controls on one window Best value Help file builder Newbee ASP.NET Questions Best way to output form information Can't Change Installation Drive for new install of Visual Studio Professional 2005 |
|||||||||||||||||||||||