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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:12:33+00:00 2026-06-17T09:12:33+00:00

I have a class that I have written to run a stored procedure, start

  • 0

I have a class that I have written to run a stored procedure, start a datareader and put the contents into a arraylist.

CLASS CODE

public class GHPSlider
{
    private clsDbAccess _db;
    private clsDbAccess _tmpDb;

    public ArrayList getBanners(int thisBannerType)
    {
        ArrayList HeroBanners = new ArrayList();
        SqlDataReader _dr = null;
        SqlCommand cmd = _db.Command;
        if (_db.Connection.State == ConnectionState.Closed)
        {
            _db.Connection.Open();
        }
        cmd = _db.Command;
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.CommandText = "GetGHPSlides";
        cmd.Parameters.Clear();
        cmd.Parameters.AddWithValue("@ID", thisBannerType);
        _dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
        if (_dr.HasRows)
        {
            while (_dr.Read())
            {
                object[] values = new object[_dr.FieldCount];
                _dr.GetValues(values);
                HeroBanners.Add(values);
            }
        }
        _dr.Close();

        return HeroBanners;
    }
}

On my code-behind I am trying to access the ArrayList so that I can loop through it and output the code to the presentation layer. I am fairly new to the n-tier way of programming and could use some help to get me in the right direction.

CODE-BEHIND CODE

Public Function GetHeros() As String

    Dim thisTestSubject As ArrayList = New GHPSlider.getBanners(1)
    'Loop through thisTestSubject ArrayList and place into HTML string to pass to literal or label
    thisBannerSlideBuilderHTML = "<div style='z-index:0;background-color:#FFF;'><a href='" + thisBannerSlideURL.ToString() + "' onclick='RecordBannerClick(this, 'Hero', 'GHP', '" + thisBannerSlideTitle.ToString() + "');'><img alt='" + thisBannerSlideTitle.ToString() + "' src='" + thisBannerSlideImagePath.ToString() + "' /></a></div>";
    'Place Inside Literal or Label to display to presentation layer

End Function

If someone could help point me in the right direction, it would be wonderful! Thanks in advance.

  • 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-17T09:12:34+00:00Added an answer on June 17, 2026 at 9:12 am

    If you’re unable to access the class that you have, you’re going to need to instantiate it. For instance,

    GHPSlider slider = new GHPSlider(); 
    

    From there, you’ll be able to access properties and methods with

    slider.getBanners();
    

    The code you are currently using is pretty cryptic, I’m not sure what you’re using it for, so it may be viable. However, you may want to read a bit about layering programs, it’ll help you mentally organize this stuff a bit. I know you don’t really have a Data Layer, but reading about Data Access Layers will probably help you to understand the architecture behind it.


    I can only really provide help from the C# standpoint, but you may be able to port it over.

    For iterating through the values of an array, it really depends on the purpose. In simplistic coding, let’s say you had an array of ten values. Iterating through them with a for loop will let you get each value, by passing it to another command.

    int[] array = new int[p];
    
            for (int i = 0; i < p; i++)
            {
                array[i] = i;
                Console.WriteLine(array[i]);
            }
    

    The output of this is a count from 0-9.

    Help with arrays!

    Now, more specifically, ArrayList

    I understand you are using older code, hence, ArrayList, but the iteration of values with a for loop is probably going to be your best bet.

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

Sidebar

Related Questions

I have a program that needs a class file written to make it run
I have a class that I've written a TypeConverter for. I want to keep
I have written a class that will handle internal logging in my application. Now
I have written an apex class that will create a PDF quote and attach
Per a client's request I have written a communication class that inherits from webclient.
I have a class written in C++ that uses also some definitions from cuda_runtime.h,
I have written a class in python that implements __str__(self) but when I use
I have the following class written by someone else that I'm trying to understand
I have an application written using C++ Builder 5 that uses the TDocument class.
I have class that looks like this: class A { public: class variables_map vm

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.