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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:12:49+00:00 2026-05-10T20:12:49+00:00

My present contract engagement is at a large E-Commerce company. Their code base which

  • 0

My present contract engagement is at a large E-Commerce company. Their code base which has origins going back to .Net 1.0 has caught me by surprise to contain many issues that raise the level of smell beyond the last crap I took.

That notwithstanding and trying to diffuse my level of distraction from it, I go along merrily trying to add in features to either fix other problems or extend more crap. Where I touch the DAL/BLL the time it will take to fix the aforementioned will be done. However I wanted to get a vote of confidence from the experts to get some assurance of not wasting the clients time or worse having my credibility voted down by touching ‘stuff that works’. Of course unit testing would solve or at least soften this worry. Perhaps this should also be added to the wtf.com?

Public Function GetSizeInfoBySite(ByVal siteID As String) As IList     Dim strSQL As String = 'YES INLINE SQL!! :)'     Dim ci As CrapInfo     Dim alAnArrayList As ArrayList      Dim cn As New SqlConnection(ConfigurationSettings.AppSettings('ConnectionString'))     Dim cmd As New SqlCommand(strSQL, cn)     cmd.Parameters.Add(New SqlParameter('@MySiteID', SqlDbType.NVarChar, 2)).Value = siteID     cn.Open()     Dim rs As SqlDataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection)     While rs.Read()         ci = New CategoryInfo(rs('someID'), rs('someName'))         If IsNothing(alAnArrayList) Then             alAnArrayList = New ArrayList         End If         alAnArrayList.Add(ci)     End While     rs.Close()     Return CType(alAnArrayList, IList) End Function 

Does anyone see problems with this aside from the inline SQL which makes my gut churn? At the least wouldn’t you ordinarily wrap the above in a try/catch/finally which most of us knows has been around since .Net v1.0? Even better would’nt it be wise to fix with Using statements? Does the SQLDataReader close really encapsulate the connection close automagically?

  • 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. 2026-05-10T20:12:50+00:00Added an answer on May 10, 2026 at 8:12 pm

    Nothing wrong with inline sql if the user input is properly parameterized, and this looks like it is.

    Other than that, yes you do need to close the connections. On a busy web site you could hit your limit and that would cause all kinds of weirdness.

    I also noticed it’s still using an arraylist. Since they’ve moved on from .Net 1.0 it’s time to update those to generic List<T>‘s (and avoid the call to CType- you should be able to DirectCast() that instead).

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

Sidebar

Ask A Question

Stats

  • Questions 104k
  • Answers 104k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer As others have said, C# is static/strongly-typed. But I take… May 11, 2026 at 8:31 pm
  • Editorial Team
    Editorial Team added an answer A modal view will cover the view it is pushed… May 11, 2026 at 8:31 pm
  • Editorial Team
    Editorial Team added an answer Sprite size - for any sort of real-time scaling or… May 11, 2026 at 8:31 pm

Related Questions

I have a WCF Service that should not enter the faulted state. If there's
I'm building a SharePoint (MOSS) publishing site for employee information on my company website.
While this doesn't apply to my present situation, I'm sure we've all been there
I have a website where my present geeky urls look like: http://www.bestatdubaiholidays.co.uk/pages/Quote/ Details.aspx?GUID=01a25b0c-e0ac-40ba-abd1-298f3abd9612 I

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.