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)
{
}
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>.
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.