I use the SQL Management Studio for create database
I create a table and create columns of table
Names of columns are on the English language like “test_ID”
in the server side when run a query(linq to sql) and got the dataTable result
server send that dataTable to client side
In the side client, I set the dataTable to a DataGridView
When DataGridView show that table, caption columns are same names columns that I create in the SQL management for my table
but I want show a another text(caption ) for columns with another language (for example my column name is “Test_Id” but a caption text for column that i want show to the DGV is “شمارنده” In the Farsi language)
and I don’t set text Columns(or caption ) in the client side, I want set a label text(caption ) for all columns in the SQL management.
in the T-SQL under syntax is true
select yourFirstColumn as TheColumnNameYouWant1, yourSecondColumn as TheColumnNameYouWant2
from yourTable
but i whant a Answer In the linq express (Lambda express)
like sample code:
var obj2 = GP.TestTables.Select(x => new { x.name });
i can alias column like this
var obj2 = GP.TestTables.Select(x => new { **alias1** = x.name });
but Without combine works sample
var obj2 = GP.TestTables.Select(x => new { ***name of company*** = x.name });
How can I do that?
Use column aliases to set the field names in your queries like so: