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 8548531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:31:07+00:00 2026-06-11T13:31:07+00:00

I just seem to be losing it today. Can anyone help me find what

  • 0

I just seem to be losing it today. Can anyone help me find what I’m doing wrong here:

1. for (int y = 0; y < 5; y++)
2. {
3.      IDataReader getLineInfo = DB.GetRS("Select LineText From TIF Where SCRID ='" + scRID + "' AND LineNum='" + y + "'");
4.      if (getLineInfo.Read())
5.      {
6.            string[] lineText = new string[y];
7.            lineText[y] = (string)getLineInfo["LineText"];
8.
9.            ((Label)item.FindControl(string.Format("lbl{0}", y))).Text = "<a href='" + lineText[y] + "' target='_blank'> Link</a>";
10.     }
11.     getLineInfo.Dispose();
12.     getLineInfo.Close();
13. }

I get the error on line 9. I originally had ‘y’ start at 1 because there is no lineNum == 0 .. but I thought since arrays start with 0 I was messing something up there. But that did not fix my problem. If someone can help me see what I’m not it would be greatly appreciated. Also there is no user input on this page cause I know The whole IDataReader using select statements can be bad.

If any additional info is needed I can write it in, and thanks to anyone who can help

  • 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-11T13:31:08+00:00Added an answer on June 11, 2026 at 1:31 pm
    string[] lineText = new string[y];  // array 0 .. y-1
    lineText[y] = ...;                  // y = 1 element too far
    

    Also, lineText is created locally inside the loop, you can simply replace string[] lineText with string lineText and forget about y.

    If you think you need y then there is something else wrong/missing in this code.

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

Sidebar

Related Questions

So obviously I am doing something wrong, but I just cannot seem to get
This is a super simple question that I just can't seem to find a
I can't seem to find anything to help my situation & was hoping someone
Im sure this is pretty simple but I just cant seem to find the
I know this has been asked before, but I just cant seem to find
I'm new to regular expression and just can't seem to figure this out: '/^[A-Za-z0-9](?:.[A-Za-z0-9]+)$/'
I've been researching but I just can't seem to get it right. I have
I'm trying to style Vanilla Forums and I just can't seem to figure out
This seems like it's basic Spring 101 stuff, but I can't seem to find
Running into another issue that I just seem cant to find any information what

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.