Click here to Skip to main content
11,477,625 members (73,097 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
In database records as follows


Room Course

1 AFF
2 MFA
3 REO
4 SAC
5 MFA
6 PST
7 RM
8 MC

i want to display the record in datagridview as follows using c#

Room Course Room Course

1 AFF 5 MFA

2 MFA 6 PST

3 REO 7 RM

4 SAC 8 MC


Note it is windows application


Rgds,
Narasiman P
Posted 9-Jul-13 18:11pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

its not feasible to divide the records from dataset and bind it to the gridview, better divide it in the StoredProcedure as two columns and return it to the application and catch the data in a dataset and bind it to the gridview.

the stored procedure will be


select d.*
	into	#temp_tab
	from(
	select
			row_number() over(order by name) rno, User_Id,
			name,
			
	from	TableName a inner join
	
	select 
			a.User_ID ID,a.name NAME
	from
			(select row_number() over(order by name) new_rno ,* from #temp_tab where rno%2=1) a
			left outer join	(select row_number() over(order by name) new_rno ,* from #temp_tab where rno%2=0) 
			
	
	
	Drop table 	#temp_tab;	
 

it will divide the records into two colummns.
Hope it helps
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 274
1 Richard Deeming 245
2 _duDE_ 175
3 Tomas Takac 150
4 Sascha Lefèvre 145
0 Sergey Alexandrovich Kryukov 7,675
1 OriginalGriff 7,256
2 Sascha Lefèvre 3,034
3 Maciej Los 2,491
4 Richard Deeming 2,305


Advertise | Privacy | Mobile
Web03 | 2.8.150520.1 | Last Updated 11 Jul 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100