Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8140779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:16:42+00:00 2026-06-06T12:16:42+00:00

I want to show the result in Label, I wrote a query by which

  • 0

I want to show the result in Label, I wrote a query by which I am getting some records, I want to assign that records based on the Name.

I have 5 label: A, B , C, D, E in these label I want to show the records.

Query:

select s.Name, count(1)as Records from tbl_Case tc
inner join tbl_subcase ts on ts.id = tc.Id
inner join tbl_supercase tsc on tsc.id = tc.supercaseid
inner join course c on c.id = b.courseid
where s.isvalid = 1 group by s.Name

From the query suppose I am getting A = 4, B = 10, c = 2, E= 100 and I did not get the record for D. so I want to show in label as 4 Records, 10 Records, 2 Records, No Records Found, 100 Records.

Please some one tell me how could I assign records in label from Code Behind.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T12:16:44+00:00Added an answer on June 6, 2026 at 12:16 pm
    lblA.Text = lblB.Text = ... = "No records found";
    using (var con = new SqlConnection("Data Source=myServerAddress;" +
            "Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;"))
    {
        con.Open();
        var com = con.CreateCommand();
        com.CommandType = CommandType.Text;
        com.CommandText = @"
            select s.Name, count(1)as Records from tbl_Case tc
            inner join tbl_subcase ts on ts.id = tc.Id
            inner join tbl_supercase tsc on tsc.id = tc.supercaseid
            inner join course c on c.id = b.courseid
            where s.isvalid = 1 group by s.Name";
        using (var read = com.ExecuteReader())
        {
            while (read.Read())
            {
                if (read["Name"] as string == "A")
                    lblA.Text = Convert.ToString(read["tc"]);
                else if (read["Name"] as string == "B")
                    lblA.Text = Convert.ToString(read["tc"]);
                ...
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a Json result that i got through a webservice, now i want
I want to show a welcome screen as well as some basic tutorials of
hello all i want to retrieve my all the wall post that i have
I have a jquery script that accesses a db and returns a numeric result
I met the problem that I want only show the sub directories but my
I have this class that im getting the information from the animated gif: using
I want to access data and show in label ajax page methods but data
I have a grid view in which I have a label in which I
I have set many lables and I want them to show the data from
From my Eclipse plugin, I want to execute a command and show the results

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.