• 12 years ago


    I would like to create a class to specify the type of connection i would like to use (SQL, OLEDB, ODBC etc.).  This shall include in specifying the data adapter, data reader, dataset and so on.

    The idea is generally like this. Assume i have four screens.  Every screen links to my database (abc.mdb). Instead of typing the connection command and the adapter command, now i want to create a object class.  All the four screen will acess this class object to obtain the connection access, including the way of connection would be.  The four screens will have to pass in parameter to specify the required table(s)

    I hope my description does not confuse you.  In short, I want to write a class that can help my life easier when changing the connection class from MS Access to SQL server. (instead of changing it screen by screen).  Please help to advise if you have this area of knowledge and experience. 

    FYI, I am doing web application. Thanks

  • 12 years ago

    Does this imply that you want to implement the Data Access Layer for your application...

    If so.. please refer this article in MSDN ... it might be of help to you.



  • 12 years ago

    Hi Kyenliew,

    you can create one Class in which you declare the Connection,Command, Data Adapter ,Data Set and Data Reader as public variables.

    Assign connection string into the constructor of that class. You can write the Common Methods for opening and closing connection in the Class file. As well, some common functions .




    Chital Panchal


  • 12 years ago

    Thanks Inferano and Chital,

    I'm still working on it. Will let you know once I've done it.

Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“There are 10 types of people in the world, those who can read binary, and those who can't.”