dcsimg
Results 1 to 3 of 3

Thread: How to get fields exist on table by passing table name by using asp.net core 2.1 ?

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2018
    Posts
    63

    How to get fields exist on table by passing table name by using asp.net core 2.1 ?

    How to get fields exist on table by passing table name by using asp.net core 2.1 ?


    How to get fields exist on table by passing table name ?

    suppose I have table name Employee on SQL server 2012

    and this is fields of Employee Table EmployeeCode,EmployeeName,,..etc

    How to make function pass to it table name and it will retrieve fields or columns as

    EmployeeCode,

    EmployeeName

    I work on web API core project with angular 7

    structure of function as below

    Code:
    public List<string> GetColumnNames(string tablename)
    {
    }

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    102,754

    Re: How to get fields exist on table by passing table name by using asp.net core 2.1

    Here's one I prepared earlier:

    http://jmcilhinney.blogspot.com/2009...formation.html

    Note that that doesn't answer your question exactly but it provides all the information you need. It explains how to get schema information in a DataTable and you can quite easily transfer data from that to a List<string>.

  3. #3
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    102,754

    Re: How to get fields exist on table by passing table name by using asp.net core 2.1

    By the way, this question has nothing at all to do with ASP.NET Core. You're asking how to get database schema information in C#, which would be the same no matter what type of application you were creating.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width