TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
abhirami umayal
NA
4
3.8k
Display values in gridview based on value of another table
Aug 22 2013 2:06 PM
i have two tables:
"subject" table:
dept | sem | subject
EC | 4 | physics
EC | 4 | chemistry
EC | 5 | english
"marks" table:
dept | sem | rollno |name | subject | marks
EC | 4 | 1 | abc | physics | 80
EC | 4 | 2 | xyz | physics | 95
EC | 4 | 1 | abc | chemistry| 90
EC | 4 | 2 | xyz | chemistry| 85
my expected "output" in the gridview is like:
(the subject names are retrieved from the subject table based on the "sem" values(sem 4-physics,chemistry;sem 5- english and so..)
dept| sem | rollno |name | physics | chemistry | total
EC | 4 | 1 | abc | 80 | 90 | 170
EC | 4 | 2 | xyz | 95 | 85 | 170
when i use a query like:
select rollno,name,marks as physics from marks where subject='physics'
i get it perfectly as my expecatation.,but, i want to display the output in a gridview in asp.net webpage using c# .,so how can do this for multiple column values(physics,chemistry)? I searched many websites,but, still im not having any clear idea.should i acheive my goal using SQL QUERY OR GRIDVIEW FEATURES? if so what features and how? pls help.
Reply
Answers (
2
)
Direct and Indirect Data Retrieve from Database in ASP.NET
refresh of parent page from child page