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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T16:22:46+00:00 2026-05-19T16:22:46+00:00

This is a bit of difficult question to ask but any feedback at all

  • 0

This is a bit of difficult question to ask but any feedback at all is welcome.

Ill start by the background, I am a university student studying software engineering last year we covered c# and I got myself a job working in a software house coding prototype software in c# (their main language is c++ using QT) after producing the prototype it was given to some clients which have all passed back positive feedback.

Now I am looking at the app and thinking well I could use this as a showcase with my CV esp as the clients who used the software have said that they will sign something to reference it.

So if I am going to do that then I had better get it right and do it to the best I possibly can. so I have started to look at it and think where I can improve it and one of the ways in which I think that I can is the way it handles the database connections and the data along with it.

the app itself runs along side a MySQL server and there is 6 different schemas which it gets its data from.

I have written a class (called it databaseHandler) which has the mysqlconnection in it ( one question was about if the connection should remain open the whole time the app is running, or open it fire a query then close it etc) inside this class I have written a method which takes some arguments and creates its query string which it then does the whole mysqlDataReader = cmd.executeReader(), this then returns the reader back to where ever it was called from.

After speaking to a friend he mentioned it might be nice if the method returned the raw data and not the reader, therefore keeping all the database “stuff” away from the main app.

After playing around I managed to find a couple of tutorials on putting the reader data into arrays and arraylists and passing then back, also had a go at passing back an array list of hashtables – these methods obv mean that the dev must know the column names in order to find the correct data.

then I stumbled across a page which went on about creating a Class which had the attributes of the column names and created a list which you could pull your data from:

http://zensoftware.org/archives/248 is the link

so this made me think, in order to use this method, would I need to create 6 classes with the attributes of the columns of my tables ( a couple of tables has up to 10-15 columns)? or is there a better way for me to handle my data?

I am not really clued up on these things but if pointed in the right direction I am a very fast learner 🙂

Again I thank you for any input what so ever.

Vade

  • 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-19T16:22:47+00:00Added an answer on May 19, 2026 at 4:22 pm

    You have a lot of ideas that are very close but are pretty common problems, but good that you are actively thinking about how to handle them!

    On the question about leaving the connection open for the whole program or only having it open during the actual query time. The common (and proper) way to do this is only have the connection open as much as you need it, so

    MySqlConnection cn = new MySqlConnection(yourConnectionString);
    
    //Execute your queries
    
    cn.close();
    

    This is better since you don’t risk leaving open connections, or having transaction issues typing up databases and resources.

    With the having just the data returned and not the actual datareader this is a good idea but by just returning the data as an ArrayList or whatever you are kind of losing the structure of the data a little.

    A good way to do this would be to either have your class just take the datareader to populate it’s data OR have the Data Layer just return an instance of your class after reading the data.

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

Sidebar

Related Questions

Probably this is not a difficult question, but I am always a little bit
I apologize if this question is a bit broad, but I'm having a difficult
This is my first question and first day in Linq so bit difficult day
The title is a bit difficult to put together for this question. Say I
I have a bit of a difficult algorithm question, I can't find any suitable
This is a difficult and open-ended question I know, but I thought I'd throw
I've been looking for the answer to this question but it seems quite difficult
The question is a bit difficult to explain, but I will try. I have
This is a bit difficult to explain, so I apologize if this doesn't make
This might be a bit difficult to explain in writing, so please bear with

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.