Using LINQ, how can I get the column names of a table? C# 3.0, 3.5 framework
Try this (LINQ method syntax): string[] columnNames = dt. Columns. Cast<DataColumn>() .
Maybe It is too late but, I solved this problem by this code
var db = new DataContex(); var columnNames = db.Mapping.MappingSource .GetModel(typeof(DataContex)) .GetMetaType(typeof(_tablename)) .DataMembers;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With