Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 30th, 2003, 04:05 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Copenhagen N, , Denmark.
Posts: 217
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to mega
Default ASP Class

I need to update or insert content (that's basically HTML with a few parameters) into a db. I need to check for data consistence and if any changes has been made (if it’s an update) correct the old data. I like to have a search function on my web site, that requires HTML tag and some words to be remove from the content and inserted (or updated) to another field/table. Last but not least I need to check for ADO errors, log them and do a roll back. All of this using an Access db.

How do I encapsulate all that. I think VBScript Classes.
I have never written a Class before but I know the basics from various articles.

Have anyone done this before and know of any pitfalls to look for?
A sketchy code of the Class would be very nice as I find it difficult to begin.
Like I got a connection that I define in an include page (db.asp), should I use that or make a new connection within the Class?


Regards - Jon

PS. I've design a database but now I'm having doubt about its structure... This might not be the place for db questions.
__________________
- mega
Aspiring JavaScript Ninja
 
Old July 30th, 2003, 06:55 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Sydney, NSW, Australia.
Posts: 215
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Whether you use a class or not is up to you. You can achieve the same results without using classes at all. You could encapsulate what you want to do in a function better than a class. The way you are talking about the problem, you are describing a series of actions. Classes are about encapsulating objects. I'd say you should create a function/sub to do the job.

As for database design, post to a forum that relates to your database program (SQL Server, Access, MySQL).

regards
David Cameron
 
Old July 31st, 2003, 08:11 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Copenhagen N, , Denmark.
Posts: 217
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to mega
Default

When would you say that classes should be used?

Regards - Jon
 
Old July 31st, 2003, 06:49 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Sydney, NSW, Australia.
Posts: 215
Thanks: 0
Thanked 0 Times in 0 Posts
Default

All the time but I don't like ASP's class support so I just can't be bothered.

Look Object Oriented Programming (OOP), in other words class based programming, is an entirely different way of thinking. You think about the data you have rather than what you want to do. There is a mental shift involved in writing that sort of code. When you write procedural code you write black box subroutines. That is you give it some inputs and it produces some outputs. It is like pushing the accelerator on a car. You push it up or down (input) and the car goes faster or slower (output). You don't know exactly what it does (hence it is called a black box), but you know how put in inputs to get outputs.

OOP is where you create black box objects. Each object can have subroutines and attributes. For example you might create a car object with an attributes: Litres of petrol, colour, model and with subroutines (member functions) accelerate, brake, steer.

I don't touch ASP classes because the things that I have come to expect from OOP just aren't there. I'd find it hard to write OOP code in VBScript.

regards
David Cameron




Similar Threads
Thread Thread Starter Forum Replies Last Post
My own class in asp.net 2.0 DarkForce ASP.NET 2.0 Professional 1 October 13th, 2008 12:39 PM
static Class in ASP chafor ASP.NET 1.0 and 1.1 Basics 4 January 13th, 2006 10:58 AM
Error When Using Webclient class in ASP.NET sebastiansony .NET Web Services 0 June 24th, 2005 12:16 AM
Class existens in ASP.NET mega ASP.NET 1.x and 2.0 Application Design 7 November 23rd, 2004 01:30 PM
A Class in ASP.NET Maxood ASP.NET 1.0 and 1.1 Basics 12 March 25th, 2004 03:31 PM





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