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

  • Home
  • SEARCH
  • 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 6549883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:08:53+00:00 2026-05-25T12:08:53+00:00

I have the label: <asp:Label ID=lbl1 runat=server></asp:Label> Code behind: protected void Page_Load(object sender, EventArgs

  • 0

I have the label:

<asp:Label ID="lbl1" runat="server"></asp:Label>

Code behind:

protected void Page_Load(object sender, EventArgs e)
{
    lbl1.Text = ImageCheck().ToString();
}

And:

protected int ImageCheck()
{
    SqlConnection connection = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\***.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True");
    string CommandText2 = "SELECT * FROM Machreta WHERE noImage = 1";
    SqlCommand command2 = new SqlCommand(CommandText2, connection);
    connection.Open();
    int check = (int)command2.ExecuteScalar();
    connection.Close();

    return check;
}

How can i return multiple values? That label display only single value but there are 6 more in the table.

  • 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-05-25T12:08:54+00:00Added an answer on May 25, 2026 at 12:08 pm

    try this:

        protected string ImageCheck()
        {
    
          var result = new StringBuilder();
    
        using(var connection = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\***.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"))
        {
            string CommandText2 = "SELECT * FROM Machreta WHERE noImage = 1";
            SqlCommand command2 = new SqlCommand(CommandText2, connection);
            connection.Open();
    
          using(var reader = command2.ExecuteReader())
          {
            while (reader.Read())
            {
              result.Append(reader.GetString(0));
            }
          }
    
          return result.ToString();
    
        }
     }
    

    of course is only an example and not fully solving your issue but should be a starting point 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this simple code: <html> <body> <form name=f1> <asp:Label name=lbl runat=server Text=Label onclick=lblClick()></asp:Label>
I have a very simple code snitppet that looks like this: <asp:Label Text=$Name$ runat=server
I have this label control in my web page <asp:Label ID=Label1 runat=server Text=test></asp:Label> And
i have a datalist control <ItemTemplate> <asp:Label ID=lblAddressID runat=server Text='<%# Bind(StudentName) %>'/> <asp:Label ID=lbl
I have a textarea in C#, please see below code: <asp:Label ID=lblQuestions runat=server CssClass=addinfo>
I have this control <asp:Label ID=lblName runat=server Text=My Name CssClass=required regular /> I want
Morning all I have frequently used the old <asp:Label ID=lblWas runat=server Text='<%# XPath(FACEVALUE) %>'></asp:Label>
I have a label control in my Page <asp:Label ID=EmpType runat=server Text= ></asp:Label> I
In an ASP.NET page I have this: <asp:Label ID=MyDateTimeLabel runat=server Text='<%# Eval(MyDateTime) %>' />
I have the following markup: <tr> <td valign=top align=left> <asp:Label ID=Label1 runat=server Text=Available Roles

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.