help

  • Thread starter Thread starter kalikoi
  • Start date Start date
K

kalikoi

Hi All

I had a table with 5 columns...i have to display all the data in the
table in a datagrid programmatically...but the problem is grid display
should be in the follwoing manner

first row of the grid should contain first 4 columns of the first
record obtained from the table
and the second row should contain the 5 column of the same first
record

this should be repeated for all the records

as an example if my table contains the following data

col1 col2 col3 col4 col5
a b c d e
f g h i j
k l m n o

the the datagrid should be dispalyed as follows

a b c d
e
f g h i
j
k l m n
o

anyone can help me??

Thanks & Regards
Kalyan
 
Hi All

I had a table with 5 columns...i have to display all the data in the
table in a datagrid programmatically...but the problem is grid display
should be in the follwoing manner

first row of the grid should contain first 4 columns of the first
record obtained from the table
and the second row should contain the 5 column of the same first
record

this should be repeated for all the records

as an example if my table contains the following data

col1 col2 col3 col4 col5
a b c d e
f g h i j
k l m n o

the the datagrid should be dispalyed as follows

a b c d
e
f g h i
j
k l m n
o

anyone can help me??

Thanks & Regards
Kalyan

You could try to make a union that creates the result in that format.
Something like:

select col1, col2, col3, col4
from TheTable
union all
select col5, null, null, null
from TheTable

This will put all the col5 values at the end, so you would need to add
some kind of sorting to get them the way you wanted.

Alternatively, create a new DataTable and populate it by looping through
your original result and adding rows to the new DataTable.
 
Back
Top