Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: .NET1.0 .NET2.0 .NET3.0 C#3.0 , +
I need to show some values which i got from Database in my grid as below,
 
Name ScoreMaths ScorePhysics
A 1 5
B 2 6
C 3 7
D 4 8
 
So i added new rows for each values in my data table and set the source of grid as data table.
But am getting out put as
 
Name ScoreMaths ScorePhysics
A 1
B 2
C 3
D 4
A 5
B 6
C 7
D 8
 
How can i solve this issue?
Please let me know if you need any more clarifications.
Posted 10-Mar-13 23:18pm
Kavitha_b1.4K
Comments
Kavitha le at 11-Mar-13 4:18am
   
I need to show some values which i got from Database in my grid as below,
 
Name ScoreMaths ScorePhysics
A 1 5
B 2 6
C 3 7
D 4 8
 
So i added new rows for each values in my datatable and set the source of grid as datatable.
But am getting out put as
 
Name ScoreMaths ScorePhysics
A 1
B 2
C 3
D 4
A 5
B 6
C 7
D 8
 
How can i solve this issu?
Plese let me know if you need any more clarifications.
Söderlund at 11-Mar-13 4:36am
   
Do it with your database query?
I´m guessing you are using sql database.
If you do a query getting only the information you need, then you already have your DataTable right there.
Kavitha le at 11-Mar-13 5:10am
   
In database i cant give it.This is just an example my table fields and values are different.
 
am using
 
dr[0] = xxx.value;
this will add rows but how to give which column it should add here?
Kavitha le at 11-Mar-13 5:20am
   
Please help

1 solution

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

Solution 1

Use table.rows[][] while adding rows
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 400
1 Jochen Arndt 200
2 Richard MacCutchan 135
3 DamithSL 95
4 Maciej Los 95
0 OriginalGriff 6,045
1 DamithSL 4,601
2 Maciej Los 4,032
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,220


Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 11 Mar 2013
Copyright © CodeProject, 1999-2014
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