Listing Columns of Table

Introduction

This blogs lists columns of a particular table using help of ado.net. you can list the columns by taking the help of GetSchema() function Connection class. see the bellow code to know how to use GetSchema method.
 
SqlConnection connection=new SqlConnection("ConnectionString");
connection.Open();
DataTable table = connection.GetSchema("Columns", new[] { "DatabaseName", null, "TableName" });