| | |
How to Get Column names of a table of MS Access (.mdb)- ODBC Connection
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
Hi all,
Im new to c#, please any one tell me how to get the column names of a table of ms access(.mdb). Here i used odbc connectivity to access the database, i got the list of tables in the database, but i dont know how to get the column name of a tables. Can any one give me a solution for the Query.
Thanks in Advance,
AshokRajendran
Im new to c#, please any one tell me how to get the column names of a table of ms access(.mdb). Here i used odbc connectivity to access the database, i got the list of tables in the database, but i dont know how to get the column name of a tables. Can any one give me a solution for the Query.
Thanks in Advance,
AshokRajendran
•
•
•
•
Hi all,
Im new to c#, please any one tell me how to get the column names of a table of ms access(.mdb). Here i used odbc connectivity to access the database, i got the list of tables in the database, but i dont know how to get the column name of a tables. Can any one give me a solution for the Query.
Thanks in Advance,
AshokRajendran
C# Syntax (Toggle Plain Text)
... ... OdbcConnection cn=new OdbcConnection("your connection string"); OdbcCommand cmd=new OdbcCommand("select * from tablename",cn); cn.Open(); OdbcDataReader dr; dr=cmd.ExecuteReader() 'First column name string first=dr.GetName(0); 'Second column name string second=dr.GetName(1); ... ... dr.Close(); cn.Close(); .....
Another ways is:
C# Syntax (Toggle Plain Text)
... ... OdbcConnection cn=new OdbcConnection("your connection string"); OdbcDataAdapter adp=new OdbcDataAdapter("select * from tablename",cn); DataTable dt=new DataTable(); adp.Fill(dt); // first column name string first = dt.Columns[0].ColumnName; ... .. ....
Last edited by adatapost; May 28th, 2009 at 8:01 am.
Failure is not fatal, but failure to change might be. - John Wooden
![]() |
Similar Threads
- sqlite3-- how to see column names for table (Python)
- Query Column names with spaces in MS ACCESS (MS Access and FileMaker Pro)
- Query Column names with spaces in MS ACCESS using Python (Python)
- Cannot Close Connection to Access MDB (VB.NET)
- ASP - MS Access help needed (ASP)
- add a new table to the database or add a new column to an existing table. (MS SQL)
- Writing to an Access Database (Visual Basic 4 / 5 / 6)
- Saving Query in Ms Access .MDb File using C++ (C++)
- Error in creating ODBC connection."Reason: Not assosiated with a trusted SQL Server" (ASP)
Other Threads in the C# Forum
- Previous Thread: C# Payroll App
- Next Thread: code to go from Form1 to Form2
| Thread Tools | Search this Thread |
.net access algorithm angle array barchart bitmap box broadcast c# capturing check checkbox client combobox control conversion convert csharp custom database datagrid datagridview dataset datetime dbconnection degrees delegate design development disappear draganddrop drawing encryption enum event excel file firefox form format forms function gdi+ httpwebrequest image index input install java label leak libraries list listbox mandelbrot math monodevelop mouseclick msword mysql operator path pause photoshop picturebox pixelinversion post programming radians regex remote remoting richtextbox round server sleep socket sql statistics stream string table tcpclientchannel text textbox thread time timer update usercontrol validation virtualization visualbasic visualstudio webbrowser windows winforms wpf xml






