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.
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:
I have a form with a couple of dropdown fields. the dropdown fields get the value from one table which is a reference table. The table consists of 3 columns - type, id, name. An example would look like this:
type id name fruits AP apple fruits GRA grapes chocolate SNI snickers chocolate MM m&m's
Currently, I have multiple sql statements to query the db for each dropdown (Select * from tablename where type='fruits') using vbscript (ms sql server database). My first question is, can i just use one sql statement to grab everthing in the table and group them together,how?
I am using DWMX on IIS 5.1 (WinXP Pro) with ASP/VBScript on an Access 2000 Database.
I'm not much on ADO yet so I let DWMX write my Database Recordsets. I noticed one of the lines of code as:
objRecordset.CursorType = 0
Later in my code, I cycle through this recordset to it's end. And then later on in the code some more I need to REcycle through it again, but I get an EOF/BOF error.
I tried:
objRecordset.MoveFirst
and
objRecordset.Requery
but am still gettin same errors.
I think I heard that CursorType 0 is forward only. So I change it to 1, 2 and 3 and still have problems. Can someone shed light on what I need to do in order to re-go through my recordset?
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?
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?
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.
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?
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.
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:
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?
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.
<% 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
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?
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?
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:
Last week, my shopping cart was still working well until I began getting the following errors 2days ago..
Error Type:
ADODB.Recordset (0x800A0BCD) Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record. ../order/saveorder.asp, line 157
Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
Page: GET /main/saveorder.asp
Could you check my code below and let me know what possibly the error is?
I have it at the moment that on the main default.asp there is a recordset that will display all records within that table, these are a list of forums that will be available.
I have a table that will show the forum name, and the description. This table is then looped using Do while not, now what i need to do is show how many records in the Treads table are related to each forum using asp. Code:
the isp i'm using has authorized ssl on my site but i dont know how to tell a particular page that it can only be run as a secure page... Where at the moment u can view the page as https or http.
I'm assuming i need some code to detect whether its being run as a https and if not redirect it to https.
I have an ASP page, on the Window_OnLoad event I use VbScript to popup an Inputbox to accept a value from the user and put it into a string called strValue. I then want to be able to go (in asp)
<%Response.Write(strValue)%[color=blue] > - but if I do that nothing happens.[/color]
How can I access the Vbscript variable in the ASP part of the page?
I tried using some code examples from (URL address blocked: See forum rules) into my defualt.aspx page (in VS2005). I had some errors with this. I thought this might be cause the tutorial at w3schools.com said it was for *.asp files.
For example I had an error ("Statement cannot appear within a method body. End of method assumed) when I tried putting a SUB in the <head>. Like this
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "(URL address blocked: See forum rules)">
<html xmlns="(URL address blocked: See forum rules)" > <head runat="server">
<% sub vbproc(num1,num2) response.write(num1*num2) end sub %>
<title>Untitled Page</title> </head>
By the way if anybody will be available to answer basic questions like this every so often throughout the day (ie: check your email or this forum every couple of hours, until midnight California time December 8), I'd be willing to pay a reasonable amount. I just need help with some of the technical details like this + finding source code
I manipulate MSAgent AcitiveX object using VBScript at client side, I met a wierd problem when I debugged my ASPX page. when msagent recognize a phrase and fire event, my vbscript capture the event and do something, including make the agent do some animation and speech, then open a browser window using 'window.open "www.google.com", "Google" '. the code works fine when I view the ASPX page with browser inside VS.NET, when browse this page in web browser from the localhost, the agent works fine, but the new window did open up. why?
I have COM+ component installed on my XP. I have problem to create instance of it inside vbscript. How can I do it? The error I get is : ActiveX component can't create object.
I'm trying to create a simple recordset, and would like to include an and/or option. to do this i set up an option on the previous page,and then sent the selection through to the next page. i was then hoping to simply insert the variable i had created into the code so that whichever of and/or is selected is used in the code. i.e.
where and_or is the variable from the previous page.
Search.Source = "SELECT * FROM dbo.Employee_List where First_Name='"&firstname&"' '"and_or"' Last_Name='" &lastname&"'"
so basically whenever someoned chooses an option its automatically filled in at the indicated location in the code. is it possible to do this and if so what is the correct syntax for using variables within this code?the full search function will have numerous fields so i'd like to avoid using if statements.
I'am running window server 2000 and MS frontpage on my computer. I created ASP page with the frontpage editor. The asp code are not running when I am trying to view the page with my browser (Explorer 5.0). Could you please help me
I have an ASP.NET solution,and the ASPX page I have a form ,I want to copy some of the data from that form to the clipboard,I am using the below script the script works fine when I use a normal anchor tag with the onclick event,but I want to be able to use an actual asp control like the hylperlink or linkbutton.
I have tried the link button but it gives an error saying Compiler Error Message: BC30456: 'VBScript' is not a member of 'ASP.sr_aspx'.
And the hyperlink control doesn't seem to have an option for the onclick. The code is located in the .aspx not in the .vb.