using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Diagnostics;

 

namespace ConsoleApplication6

{

    class Program

    {

        static void Main(string[] args)

        {

            DataClasses1DataContext dc = new DataClasses1DataContext();

            Console.WriteLine("Database: {0}", dc.Mapping.DatabaseName);//数据库名称

            Console.WriteLine("The table count is {0}",dc.Mapping.GetTables().Count());//表的数目

            var tables = from t in dc.Mapping.GetTables()

                         orderby t.TableName

                         select t;

 

           

            foreach (var table in tables)

            {

 

                Console.WriteLine("Tablename is :"+table.TableName);//表名称

                Console.WriteLine("The column count is :{0}", table.RowType.DataMembers.Count);//字段数目

                foreach (var col in table.RowType.DataMembers)

                {

                    Console.WriteLine("\t{0}\t{1}", col.MappedName, col.DbType);//字段名称及字段类型

                }

            }

            Console.WriteLine("This is the end.");

            Console.ReadLine();

        }

    }

}

 

相关文章:

  • 2021-06-10
  • 2021-09-28
  • 2022-12-23
  • 2021-06-10
猜你喜欢
  • 2022-01-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-07
  • 2022-02-09
相关资源
相似解决方案