Classes With Databases

I'd like to create a class file for a shopping cart that I'm working on but I'm not sure about how to use the database with it.

Do I connect and open to the database inside the class or outside of the class and set the properties?

I'm thinking that if I open and close the database with say a getItem() method and I have 15 items to get, I'll be opening and closing a connection 15 times. Isn't that bad?

View Replies


ADVERTISEMENT

Two Classes

When I write the code
Code:

Set a = new C1
Block of code
Set a = Nothing

Set b= new C2
Block of code
Set b = Nothing


The Class C2 doesn't work.

View Replies View Related

ASP Classes

I've been searching for some information on the use of Classes in ASP, but
found very little information.
I found this http://www.daniweb.com/tutorials/tutorial19997.html .
Are there more information somewhere online?

View Replies View Related

Classes Vs COM

For the majority of my work, I just use plain ASP. On the rare occasion that
I am doing something intensive that does require user interaction I might
create a COM component (ie where performance gain outweighs the overhead of
COM).

A simple Rule-of-Thumb. I imagine this is fairly common practice... (I hope
it is, at least).

However, I'm curious about VBScript Classes. I would have imagined that if a
page was complex enough to merit defining and creating your own
classes/objects, that COM would be appropriate...

In which case, when and how do people use VBScript Classes?

View Replies View Related

VB Classes

I am re-coding a VB application to be used on the web, some of which requires additional DB components for user registration etc. Usually I use ASP classes to manage the DB I/O stuff but I was wondering whether they are any benefits in having them as VB classes and compiled as dlls?

I like the idea of having the VB application as dlls, but using asp classes for the general functionality of the application. However, I don't wish to do this out of convience for myself.

View Replies View Related

Classes

one developer once told me that he doesn't use classes as there is a performance issue. is this true? the functions i'd be creating can easily go into an include file as a set of functions and not a class. so i'm not too sure about going ahead and encapsulating them into classes. has anyone got any input?

View Replies View Related

Classic ASP Classes

I've been working in .NET for some time now and I don't remember specifically
how asp classes are cleaned up in classic asp. I've been put on a Classic
ASP project(ugh) and we're having some serious stability problems. Once we
reach a point of sustained CPU useage of over 80% IIS 6 restarts the w3wp.exe
process which of course terminates all sessions and resets the website.

I've
noticed that the previous developer has an include which creates a couple of
class objects in ASP. Not third party or "CreateObject" objects, but ASP
classes. This include is in A LOT of files and the classes not being
destroyed in any of them.

My question is could this be the problem? I seem to remember a problem with
ASP classes and not destroying them causing leaks of some sort. I need to
mention that the memory doesn't seem to be leaking but the CPU utilization
goes wacko as if ASP/IIS is corrupt. My environment is Windows 2k3 and IIS
6. The previous environment was Windows 2K and IIS5. Both environments had
the problem.

Before I go through these hundreds of files I was wondering if anyone
remember what the problem was with ASP classes not being destroyed.

View Replies View Related

Classes And Collections In ASP?

I've always had problems getting my head around using collections and classes together. Separately, they seem like fairly simple subjects, but I'm getting muddled up when trying to use them together.

Can someone toss together a simple example of how I'd create my classes and collection? Code:

View Replies View Related

Write Classes/com In Asp

I write classes in php, beans in jsp, what "modularity" does asp have? Can I write classes? Or "com" what can I do? which advantages exist with these paths: classes, com, etc.

View Replies View Related

Classes And Recordsets

Assuming I create an object as below

<%
Dim objMainItem
Set objMainItem = New ItemContent
objMainItem.item_id = 1
objMainItem.Open()
%

and the class ItemContent creates a recordset based on the item_id passed in. Each item record contains the fields (header,label,content). I would like to reference the fields in the following format

<%= objMainItem.header %

View Replies View Related

Using .NET Classes In An ASP Classic App?

Is there a way to use classes written in .NET in an ASP classic application? Maybe similair to using DLLs with Server.CreateObject? I want to write all our new classes using .NET with the intent of eventually changing the web application to ASP.NET.

I've tried Googling for the answer but I only get ASP.NET literature. Any suggestions for that problem?

View Replies View Related

Using Two Classes In My Code

Suppose if I am using two classes in my code Say C1 and C2 then is there some procedure or special way to use them one after another.

Set a = new C1
Block of code
Set a = Nothing

Set b= new C2
Block of code
Set b = Nothing

The Class C2 doesn't work. Any idea Why?

View Replies View Related

Validation Inside Classes

I'm currently new to OO programming with Classic ASP and have been stopped dead in my tracks on the issue of validation inside classes and if I should be doing things that way. I have been using a User class and it has methods such as Save(), Update() and Delete(). Particularly with the Update() method I'm unsure if I should be validating my form(s) within the class or on the actual edit.asp page that uses the Update() method?

I have two types of edit pages; one for Admin users and one for the My Account page. On the My Account page if the user wants to change their password they have to enter their current password, a new password and then their new password again to confirm .

If an Admin user is updating that same user's info they do not have to go through those steps and they can simple just change the password by typing it in. The point here is that there are two separate cases of validation rules on two separate pages that both use the Update() method. Do you validate your forms inside your classes or outside?

View Replies View Related

Pass Array Of Classes

I'm trying to pass an array of classes through a function using vbscript and then access these the other side. for instance (in psuedo code)

redim Array()
for 0 to array end fill with data (these happen to be classes)
but not sure that should make any difference?!)

someFunction(array())

function someFunction(data)
response.write data(0).property
end function

which doesn't work although data.property does if I specify which part of the array I'm passing i.e. someFunction(array(1))

View Replies View Related

Vbscript Classes & A Recordset (ASP)

I've written two classes in ASP (vbscript). Basically I am attempting a form of data encapsulation. The classes are a "master" class and an "address" class. The address class basically wraps a recordset. I've attached the file. whenever I call the "move" method the recordset should be EOF since there is only 1 record in my streetaddress table. If I write out the value of of p_oRs.eof inside of the "move" method it returns true.

I have declared p_oRs as a public variable. But if I access it from a different method (or a property get/let) then the p_oRs recordset is no longer EOF the pointer is on the first and only record.

View Replies View Related

Are Vbscript Classes Fast?

Say I have a few functions for accessing a database e.g. openDBConn, closeDBConn, openRs, closeRs, getRsAsArray, executeSql, getDbConnString etc

I could put these functions in to an include file "incDbHelper.asp" and include the file in any page that needs database functionality... or I could create a class "clsDbhelper.asp" which again I would include in any page that needs it. Now once the files have been included, to access the functions I could do: Code:

View Replies View Related

User-defined Classes In Global.asa

I've read that one shouldn't include ADO objects in the Global.asa for the sake of performance, but would user-defined classes cause the same kind of performance hit? Assuming that they wouldn't, is it possible to do it?

I can't seem to figure out how to include them, nor find any reference to it in msdn.

Is there a way to do this? Or should I create a slew of Session variables? Code:

View Replies View Related

Error Handling Inside Classes

I can't seem to get error handling to work from inside my classes. On the outside it works but on the inside it doesn't. Any thoughts?

if err.number <> 0 then response.write "errors" end if

I'm trying to catch all the errors as I go and I can't do that if it won't work on the inside of my classes.

View Replies View Related

Using Databases With ASP

I'm learning ASP with a database in Access (new to Access also). I have created my tables and all but I'm stuck on how to query the table. I'm familiar with sql statements, so I was wondering if you can access the database the same way as with php and mysql. I.E.
Code:

Select * From Table Where id = 5.

Something like that, or will I need to use
Code:

objRS.Filter "ID = 5"

I guess the main question is does Access accept SQL statements and if so can you give me some examples as to querying the database.

View Replies View Related

ASP And SQL Databases

I am working on ASP and SQL Databases. I have written the code . the program is very simple . its just an application form and u will be having upload and submit button . So after the data is being entered , the submit button code should be invoked and the data entered should be stored in the database.

View Replies View Related

Asp And Databases

I'm having Difficulty understanding the concept of retreiving information from a database upon user request. E.g i have an ASp page that has a form with 3 drop down boxes and a submit button.

I want the next page to bring results from the database that meet the criteria set upon by the 3 drop down boxes. The DB is Access and its already got the information in it, i just want the correct information to come up in tables once the user has selected the choices in the drop down boxes.

View Replies View Related

Databases

If i upload an ASP page that is connected to an MDB (Access) database to my FTP server, is there any way that I can ensure that no one can download the database and that it remains "untouchable".

View Replies View Related

Checkboxes And Databases

The problem I have is that I need to save the content of a form in a database, and I donw know how to save the content of a checkbox, can you give me an example of the code?

View Replies View Related

Multiple Databases

I need script or a link to a tutorial that will allow me to do the following.

User enters username and password site checks the username and password against database1
if the user entered the correct username and password the page shows records from database2 if the user enterend incorrect username or password then nothing happens.

I am new to this forum and really looking forward to being involved in the community.

View Replies View Related

Searching Databases

I'm trying to design a simple website with 2 dynamic searching functions. The first is the user enters text into a search box, clicks on the search button and then connects to a sql or access database and brings back those records that are LIKE the search phrase. It's my intention to then have a detailsview link on the searches so the user can drill through.I'm designing an online version of my catalog so that the user can browse by page. I also want the user to enter a page number and then click go and that would then take the user to the corresponding page in the catalog. I'm guessing I'll need to declare If 1 then open page1.html, if 2 then open page2.html.
I know I'm close but not close enough and my knowledge has been well and truly stretched and I must have read and read my Dummies book about 20 times over the last week.

View Replies View Related

Access Databases

For my ICT (computers) project at college I'm using an Access database, and I now have a problem with that. Basically the way it works is that the user enters their details in a form page (here). This then does the usual thing; runs a script which inputs the data into a database and then displays a thank you message.
the problem I'm having is that whenever I input punctuation into the form, it refuses to work; it comes back with a 500 server error. This is understandably quite irritating, as I'm setting up a mailing list that needs to incorporate a list of email addresses

View Replies View Related

MySQL Databases

My hosting account gives me a lot of MySQL databases but I usually just stick with MS SQL Server because it gives me fewer troubles.Now I want to challenge MySQL again. I use connString "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=myserver; DATABASE=mybase; UID=myID;PASSWORD=myPwd; OPTION=3"

And the conn and recordset objects connects smoothly with the database. I can even get the things i want out of it. But every time I try to update the database such as:

rs("Content")="Cool"
rs.update
'or
names=array("Content")
values=("Cool")
rs.update names, values

It just wouldn't work...why? Content field is a text field.

View Replies View Related

ASP And Relational Databases

What i need to do is build 2 tables below with the following fields:

tblUsers
id
name
address
postcode

tblShop
id
product

Now i need to build a relation between the two id fields but what i relaly need to know is how to retreve the data in the tblUsers from the id in the tblShop through asp. This is like for a shop

View Replies View Related

Multiple Databases

I'm trying to pull information from two different databases, use it, and then put it back into a database. The program I am writing is one which will keep track of exempt employees' absences. At the end of the year, employees get to rollover the sick days that they do not use. Herein lies the problem. The information on how many sick days an employee is in an AD download on one server. The information on how many days that employee has taken this year is on another. I need to take that information do a little math, and then add those days into a different table on the same server that the absences came off of to keep track of their "sick bank".
I would like to just Loop the information, but I cannot put recordsets inside recordsets and I cannot create a view from two separate servers, so I am at a stop sign. Can I just take all of the users and the amout of sick days they have and put them in a text file and then pull off of the text file? I'm not quit sure how to do this.

View Replies View Related

Three Databases Tables

How do you go about searching three tables at the same time? I'm using Dreamweaver MX, but I can also hand code it in if know one knows the dreamweaver method

View Replies View Related

Querying From Two Databases?

Given if tables A and B are in the same database, writing a query for them is relatively easy. But what if tables A and B are in different databases? Is it possible to query them together? If so, can anyone provide a generic example?

View Replies View Related

ASP & MS Access Databases

I have a search page with an access database in the background.
When you type in a keyword, it brings the related article up.

Is it possible for this to display a hyperlink??? When i choose hyperlink in the access field it displays thefollowing on the screen: Code:

View Replies View Related

Dates And Databases

Inserting into an Access database using the above script generates this
error :

Microsoft JET Database Engine error '80040e07'
Syntax error in date in query expression '#20031021 20:36#'.

Using SQL : UsersTable SET UpdateTime=#"& dbDate(Now())&"# .....

If YYYYMMDD hh:mm:ss is a universal date, why is it rejecting it?

If I change it to YYYY/MM/DD hh:mm:ss it then becomes valid. Is this valid
in all situations, or am I doing something wrong in the first step?

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved