Using the business Object

Now that the business object has been defined, all we have to do is see how it is used in the code. If you remember, we created a global instance of the business object at the top of the script. This instance is used in the remaining subs.

The Page_Load is exactly the same as before except that we have a new line of code at the top. This assigns the datasource’s DSN to the DSN property of the business object.

Sub Page_Load(Src As Object, E As EventArgs) 

    myProject.DSN = "server=localhost;uid=sa;pwd=;database=ProjectPal" 

Now you can see a change. The code in the SetupCombo sub is no longer concerned with accessing the data. Instead, it requests and binds the return value from the business object’s getProjects method, ...

Get Inside ASP.NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.