help

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
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top