|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Help - Asp DB Middle Tier component!!
I've been developing asp sites for about 2.5 yrs now and recently went on a course where the instructor informed me that instead of putting all my database access routines in the asp page itself, I should create a vb component to deal with all database access.
My question is this, Is this fact and if so what is the methodology behind it. I have interfaced vb components into asp before, but cant think how to make a generic component to deal with all my database access. I have also failed to find anything on Google Groups etc. Many thanks for any help. |
|
#2
|
||||
|
||||
|
A common buzz word in programming right now is 3 tier and N tier programming... The methodology behind this is seperating your presentation layer with your business logic... the third teir comes in with database server...
Personally I'm still trying to sort through the models myself... I think the ideas are all logical in seperation of code and so on, but I'm not sure how well implemented this type of design is in the real-world From what I understand, the N Tier model is relatively new with the .NET technologies... I may be mistaken though =) |
|
#3
|
|||
|
|||
|
Yeah, sounds like im in the same boat as you with those thoughts, but have you ever seen the database logic removed from the main asp pages into vb components/asp classes in an attempt to modularise the functionality?
Let me pose a problem - a large asp driven web site is up and running with access back end, let suppose that the site is going to move to sql server. Of course All sql is going to be in stored procedures and views in the access database, these will be re-written in T-SQL (easy enough), but what of the database logic that is stored in the many asp pages ? If a common component was created to deal with the database logic that simply returned data to the asp page, then any change to database side could be simply udpated in one place (the component) without affecting the asp pages - you could even provide the ability for the component to change data sources dynamically if one failed etc... Any ideas on the way this component would be constructed? |
|
#4
|
||||
|
||||
|
Your instructor is correct, and you seem to have grasped the separation theory. It really is as simple as thinking, ok, if I have a large project (or any size), what is the best, most effecient way i can write it, so that I don't have to change anything more than once, should a change be required. Well, this is how I look at it anyway.
This theory applies both to code (db access, functions, etc) and the site look and feel (html templates). It's quite easy to achieve, with proper planning. I wouldn't go as far as writing a VB component just to handle DB connectivity calls (which is only 2 lines of code anyway, but still should be separate - just use an include). A fairly simplified way of looking at it is, never have the same code twice in a given project. To write a VB component is kinda tricky at first, but like most things, simple once you've done it. Load up vb, start writing a class, and any method and properties, compile as a DLL. Register the DLL on the webserver. Then, in your ASP, you call your component (COM object) like: Code:
set myObj = server.createobjecT("Project.MyClass")
|
|
#5
|
|||
|
|||
|
Stumpy,
Many thanks for that, I will work through that tutorial and see what I can come up with, I was beginning to think that no-one could help me here ive been looking at this topic for some days now with no new info on it lol)Regards, Robbo |
|
#6
|
|||
|
|||
|
Quote:
but is it practical?,If I don't have desktop access to Webserver and have only FTP access. is it mean I have call every time the Server peoples to register a Dll for my site. |
|
#7
|
|||
|
|||
|
A valid point there. In my case it is not an issue! however there are ways of registering dlls without direct server access!! using asp for example ;-)
|
|
#8
|
||||
|
||||
|
Reg/Unreg a DLL using plain ol' ASP, which I just found using google.
http://stardeveloper.com/articles/d...02061202&page=1 |
|
#9
|
|||
|
|||
|
Yeah exactly, I would have put a link on earlier,but I was in a rush, apologies for that!
|
|
#10
|
||||
|
||||
|
The only time I've needed to create a DLL is when I built a large marketing system (the mailer component) and we needed the huge speed boost that compiled code offers over ASP. I guess you would also create one if you needed to protect your code from a 3rd party. Otherwise, just use includes. I find the debugging/registering/unregistering/restarting IIS very tedious when using VB COMs.
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > ASP Development > Help - Asp DB Middle Tier component!! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|