p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 1.0 and 1.1 Basics (http://p2p.wrox.com/forumdisplay.php?f=60)
-   -   DataBase Class (http://p2p.wrox.com/showthread.php?t=16128)

stu9820 July 29th, 2004 09:26 AM

DataBase Class
 
When someone says you should create a DataBase Class to handle all the database calls what exactly would I put in the class? Would it handle pages like the registration page and have the DataBase Class retrieve the txtFirstName and etc values?


planoie July 29th, 2004 11:35 AM

Usually when we say this we mean this:

Make a class that contains the logic to call the database and handle the various aspects of data manipulation. Use this as the layer between the database itself and the UI. This class shouldn't deal with UI issues, only data issues. For example:

Public Class MyDataLayer
    Public Shared Function LoginUser(ByVal username As String, ByVal password As String) As Boolean
        'Use "username" and "password" variables
        'as your criteria for the SQL call here
        '
        'Call database
        'Provide return result
    End Function
End Class

Now your UI layer (the aspx page) will call this from the Login button click handler:

If MyDataLayer.LoginUser(txtUserName.Text, txtPassword.Text) Then
    'User is logged in, handle accordingly
Else
    'User is NOT logged in, handle accordingly
End If

mehdi62b July 29th, 2004 02:39 PM

Peter, you meant Componentization?
building a class for evry table(just declaring one field for evry column in the Table) and build another unique class that manipulates these table classes and ....
Peter what is the meaning of UML(Unified Modeling Language) here and how I can find best articles about desining them I don't want to learn ADO.NET,ASP.NET,and.... I want to learn for example how I can design my Tables and relations between them and also how I can make a good componentization in the best manner?!!!)
do you know some good resorces about them?
Thanks in advance.


--------------------------------------------
Mehdi.


All times are GMT -4. The time now is 08:09 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.