Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
The informations are stored in diff tables of a database. For instance DB name say DB1. It has tables such as task,story,person,... I want to check the condition as if task.acceptor_id and story.owner_id=person.userId, then name of the task and story should be displayed in the particular user's page.
I also want to display the details of the tasks/story for a user/dev in a project website checking the condition that the user/developer is only assigned to any task/story of the project. Or it should not be display any tasks/story related information in his/her page.
should be done in C#
Please help me to finish it.
Thanks in advance...
Posted 23-Dec-12 23:01pm
Comments
Sampath Kumar Sathiya at 24-Dec-12 5:05am
   
Have you tried anything, Please give those details?
Zoltán Zörgő at 24-Dec-12 5:29am
   
This is not a "quick answers" kind of question. Much like a whole project. Nobody will be able or willing to do the job for you. You have to try to solve by yourself, and if you get lost somewhere, and you have a really concrete question in a really concrete situation, you can come back, and we will be willing to help you - and most likely able to help you if it is possible.
You have not even specified if you want to make a thick (windows forms) or thin (asp.net) application...

1 solution

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

Solution 1

Try using an SQL JOIN:
SELECT t.Name, s.Name FROM person p
JOIN story s ON p.userId=s.owner_id
JOIN task t ON p.userId=t.acceptor_id
All you have to do is package it in C# code:
using (SqlConnection con = new SqlConnection(strConnect))
    {
    con.Open();
    using (SqlCommand com = new SqlCommand("SELECT t.Name AS task, s.Name AS story FROM person p JOIN story s ON p.userId=s.owner_id JOIN task t ON p.userId=t.acceptor_id", con))
        {
        using (SqlDataReader reader = com.ExecuteReader())
            {
            while (reader.Read())
                {
                string task = (string) reader["task"];
                string story = (string) reader["story"];
                Console.WriteLine("{0}, {1}", task, story);
                }
            }
        }
    }
  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 404
1 Nirav Prabtani 273
2 OriginalGriff 199
3 _Amy 165
4 Maciej Los 145
0 OriginalGriff 7,755
1 Sergey Alexandrovich Kryukov 6,951
2 Maciej Los 3,994
3 Peter Leow 3,698
4 CHill60 2,742


Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 24 Dec 2012
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