Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Design ideas needed for static data access class

Design ideas needed for static data access class

Scheduled Pinned Locked Moved Visual Basic
databasedesign
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jim Taylor
    wrote on last edited by
    #1

    I need to design a dataaccess class that will allow me to call the same stored procedures on different databases. I want the class to be static but also to take advantage of connection pooling. I guess each method will need to be passed the database connection string. I will also need a collection of connection objects that I will need to manage (one for each database). Are there any good reference articles on this that anyone could point me in the direction of. Do you need more info on what I'm trying to achieve to answer this query, if so please post back. Jim

    M 1 Reply Last reply
    0
    • J Jim Taylor

      I need to design a dataaccess class that will allow me to call the same stored procedures on different databases. I want the class to be static but also to take advantage of connection pooling. I guess each method will need to be passed the database connection string. I will also need a collection of connection objects that I will need to manage (one for each database). Are there any good reference articles on this that anyone could point me in the direction of. Do you need more info on what I'm trying to achieve to answer this query, if so please post back. Jim

      M Offline
      M Offline
      Mike Ellison
      wrote on last edited by
      #2

      Hi Jim. Are the databases all from the same provider? (e.g. are they all accessed using either the SqlClient classes, or the OleDbClient, or some other provider?) If they're all accessed using SqlClient classes, I would think a simple Array or ArrayList would work for holding your SqlConnection objects. Then your method for calling your stored procedure could loop through the connections array, performing the following tasks: open the connection, set up a SqlCommand object for the stored procedure, call the SqlCommand.ExecuteNonQuery() method, and finally close the connection.

      J 1 Reply Last reply
      0
      • M Mike Ellison

        Hi Jim. Are the databases all from the same provider? (e.g. are they all accessed using either the SqlClient classes, or the OleDbClient, or some other provider?) If they're all accessed using SqlClient classes, I would think a simple Array or ArrayList would work for holding your SqlConnection objects. Then your method for calling your stored procedure could loop through the connections array, performing the following tasks: open the connection, set up a SqlCommand object for the stored procedure, call the SqlCommand.ExecuteNonQuery() method, and finally close the connection.

        J Offline
        J Offline
        Jim Taylor
        wrote on last edited by
        #3

        Mike Yes they're all SqlClient. I think I will try your method and see how well it works. Thanks Jim

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups