Obtain the table name in dbf and the dbf table name.

Source: Internet
Author: User

Obtain the table name in dbf and the dbf table name.

For special needs, you need to obtain the name of the table in the dbf DATABASE. The following solutions are available:

1 public List <string> GetTableFields (string path) 2 {3 List <string> tables = new List <string> (); 4 var dt = GetSchemaTable (ConnectionString ); 5 foreach (DataRow dr in dt. rows) 6 {7 tables. add (dr ["COLUMN_NAME"] as string); 8} 9 return tables; 10} 11 12 private DataTable GetSchemaTable (string connectionString) 13 {14 using (OleDbConnection connection = new15 OleDbConnection (connectionString) 16 {17 connection. open (); 18 DataTable schemaTable = connection. getOleDbSchemaTable (19 OleDbSchemaGuid. columns, 20 new object [] {null, null}); 21 return schemaTable; 22} 23}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.