Click here to Skip to main content
15,912,507 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How in the name of the column to get the Access database.And they do put in an array ?

this is my database (access),(NAME'S TABLE :table1):

ID / NAME / FAMILY /
--------------------------------------------
200 / JIM / ANISHTAIN /
201 / EHSAN / REZAI /
---------------------------------------------
HOW ME GET COLUMN HEADER AND THEY PUT IN AN ARRAY?

OUTPUT:

{ID,NAME,FAMILY}
Posted
Updated 19-Jun-10 1:56am
v3
Comments
Smithers-Jones 19-Jun-10 7:23am    
"help me please" isn't a sensible subject. Everybody coming here needs help with their question. think about a better subject line.

Get the dataset and put the column names into a array
 
Share this answer
 
dim dbConn as new oledb.oledbconnection 
dbconn.connectionstring = "Provider = Microsoft.Jet.Oledb.4.0; Data Source = " & App.StartupPath & "\YourDatabaseFileName.mdb"
dbConn.open

dim DA as new Oledb.OledbDataAdapter("Select * from table1",dbConn)
dim ds as new dataset

DA.FillSchema(ds)

dim strArray as string()
ReDim Preserve strArray(ds.Table(0).Column.Count
For i as int =0 to ds.Table(0).Column.Count-1
   strArray(i) = ds.Table(0).Column(0).Caption
next
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900