ADO.net

  • 11 years ago

    Hi,

    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 VB.net web application. Thanks

  • 11 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.

    http://msdn.microsoft.com/msdnmag/issues/03/04/DataAccessLayer/default.aspx

    http://msdn.microsoft.com/asp.net/reference/data/default.aspx?pull=/library/en-us/dnaspnettut/html/aspnet_tutorial01_dataaccesslayer_vb.asp

    Regards

     

  • 11 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 .

     

    Regards,

     

    Chital Panchal

     

  • 11 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).

Contribute

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.

“Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why. Programmers combine theory and practice: Nothing works and they don't know why.”