Click to See Complete Forum and Search --> : Database Columns List !!!
DTMB
May 28th, 2004, 07:20 AM
Hi, I have a database problem. I want to know (by code) what is the best way, in C#, to optain the list of the columns of a specific table in a Microsoft Access Database. I must know, for every column, also the type (text, int, ecc).
Thank you very much for all answers.
DTMB
IAmChris
May 28th, 2004, 08:30 AM
Not really sure, but your could use the FillSchema() method of the DataAdapter class to create a table in a dataset, then go through each column in the newly created table. Using this you can also find out which columns are set as primary keys or have other constraints or properties (such as auto-increment) defined.
It may be a bit ugly but at least it'll get the job done...
DTMB
May 28th, 2004, 09:09 AM
Thank you very much for the answer. I will try to use this technic, but it's very ugly and complicate (as you said). I think that the C# db manage classes for simple operations are so complex.
Again Thank you very much.
DTMB
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.