Click here to Skip to main content
15,123,118 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,
i want to show in my datagridview two columns of my datatable in one column of the datagridview. Is this possible?

Thanks
Posted
Comments
PIEBALDconsult 31-Oct-14 14:38pm
   
Concatenate the values in the query?
Sergey Alexandrovich Kryukov 31-Oct-14 14:50pm
   
What does it mean? Two separate columns with common header? One column combining data of two columns in one or another way? Anything else? What exactly?
—SA
Issa Jaber 31-Oct-14 14:56pm
   
yes i want one column in a datagridview combining data of two columns of a datatable
Sergey Alexandrovich Kryukov 31-Oct-14 15:14pm
   
Than, does Solution 1 suites you? Or you can combine it an any other way...
—SA
Issa Jaber 31-Oct-14 15:24pm
   
no it does not suite because i want to show the name of the customer in the column but i want to search first name and last name separately
Sergey Alexandrovich Kryukov 31-Oct-14 15:33pm
   
Then add a comment on the answer. Why searching separately? Do you really want that the name and last name in the row correspondent the same individual? If so, use just one query.
—SA

As PIEBALDconsult said, you can combine the values in SQL.

SQL
SELECT field1 + ', ' + field2 AS newField 


and then add newField to your Grid.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900