How to get the amount of colums from a SQL database with LinqDataSource?

Var columnNames = db.ColumnNames(). Where(n => n.Member. GetCustomAttributes(typeof(System.Data.Linq.Mapping.

ColumnAttribute), false).FirstOrDefault()! = null). Select(n => n.Name) Get the column names with the above code.

Then find the count of columnNames and youve got what you want :) Let me know if this helps.

Var columnNames = db.ColumnNames(). Where(n => n.Member. GetCustomAttributes(typeof(System.Data.Linq.Mapping.

ColumnAttribute), false).FirstOrDefault()! = null). Select(n => n.Name); Get the column names with the above code.

Then find the count of columnNames and youve got what you want :) Let me know if this helps.

I tried it, but it does not work for me. Need to look deeper into it later. Will let you know then!

Thanks – Evils Oct 14 at 15:05 Okay worked! Thanks – Evils Oct 17 at 5:30.

My situation is that I have my ASP.Net project where I have one Microsoft SQL Model which I imported and created an entity model with. Within that model I have one table with 10 "columns". I "connected" that model with a LinqDataSource object.

My question is now, how can I access that DataTable through that LinqDataSource to get the amount of columns back? Thanks in advance!

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions