473,651 Members | 2,538 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What is this ??

Hi guys,

can anyone explain line number 5 to me. i don't quite understand what
is going on there and why.

1 <script language="vbscr ipt" runat="server"> sub Application_OnS tart
2 getcustomers
3 end subsub getcustomers

4 set conn=Server.Cre ateObject("ADOD B.Connection")
5 conn.Provider=" Microsoft.Jet.O LEDB.4.0"
6 conn.Open "c:/webdata/northwind.mdb"
7 set rs=conn.execute ("select name from customers")
8 Application("cu stomers")=rs.Ge tRows
9 rs.Close
10 conn.Close
11 end sub</script>
also what is the meaning of the key word set here. is it an array? is
it a connection ( i ask this cos it gets "closed" later in line 9)

also i presume that customer would need to be declared somewhere as...
dim customers(aNumb er). am i correct?

if so, how would i be sure that the size given to the "customers"
array would be big enough?
is there such thing as an array that can hold any number of elements
in ASP?

thanks guys.

Liza
Jul 19 '05 #1
1 2065
Some of your questions go beyond what can be taught in a newsgroup post, but
I'll try. Here is the online ADO Programmers Guide:
http://msdn.microsoft.com/library/en...troduction.asp

Liza wrote:
Hi guys,

can anyone explain line number 5 to me. i don't quite understand what
is going on there and why.

1 <script language="vbscr ipt" runat="server"> sub Application_OnS tart
2 getcustomers
3 end subsub getcustomers

4 set conn=Server.Cre ateObject("ADOD B.Connection")
5 conn.Provider=" Microsoft.Jet.O LEDB.4.0"
ADO (ActiveX Data Objects) is the technology used to allow your
vbscript/jscript/vb/etc. code to interface with databases. It consists of
several COM objects that expose the methods and properties required to work
with data from various databases. OLEDB is the name of the code foundation
that is used by ADO objects. OLEDB connects to various databases via the use
of Providers which can come from Microsoft (these are included in the
Microsoft Data Access Components (MDAC) installation package available from
www.microsoft.com/data - MDAC is automatically installed with later versions
of IE and is included as part of the operating system in Windows 2000/XP and
later), or from non-MS database suppliers. There is an older database
technology called ODBC which can still be used in ADO using the MS OLEDB
Provider for ODBC (MSDASQL), but this is not recommended because it forces
you to use two software layers to get to your data (OLEDB and ODBC).
Instead, you should use the native Providers for your specific database.

In this case, it looks like you're attempting to connect to an Access (Jet)
database, using the native Jet OLEDB version 4.0 provider. You can find many
examples of connection strings at www.able-consulting.com/ado_conn.htm.

6 conn.Open "c:/webdata/northwind.mdb"
7 set rs=conn.execute ("select name from customers")
8 Application("cu stomers")=rs.Ge tRows
9 rs.Close
10 conn.Close
11 end sub</script>
also what is the meaning of the key word set here. is it an array? is
it a connection ( i ask this cos it gets "closed" later in line 9)
In general, "set" is used to cause a variable to refer to a binary object
(usually a COM object), so that the variable behaves as if it WAS that
binary object. In line 4 it was used to cause conn to refer to an ADODB
Connection object that was returned by the CreateObject method. In line 7,
it is being used to cause the variable called rs to refer to the ADODB
Recordset object that is being returned by the Connection object's Execute
method.

In line 8, an Application variable is being set to the array that is being
returned from the Recordset object's GetRows method.

also i presume that customer would need to be declared somewhere as...
dim customers(aNumb er). am i correct?
No, Application and Session variables do not need to be declared. Once
created, they are available to any page belonging to the Application or
Session. Do not be tempted to store ADO objects in Application or Session:
it may be counter-intuitive, but storing a "global" COM object can severely
impair an application's performance since only one page at a time will be
able to use it.

if so, how would i be sure that the size given to the "customers"
array would be big enough?
The array returned by GetRows is created behind the scenes: you do not have
to worry about sizing it.
is there such thing as an array that can hold any number of elements
in ASP?

http://msdn.microsoft.com/library/de...svariables.asp

Do you have the vbscript documentation? here is the link where you can
download it:
http://tinyurl.com/7rk6

Here are some good asp resources:
www.learnasp.com
www.4guysfromrolla.com
www.aspfaq.com
www.asp101.com

HTH,
Bob Barrows
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
3882
by: Randell D. | last post by:
I have just recompiled, upgraded to PHP 4.3.4. As an exercise (and curiosity) I've decided to test out PDF functions and got the test in the PHP online manual working. I had one problem whereby the example refered to Times New Roman - I didn't have this, but I did have Times-Roman which worked. My question - How do I know what fonts I *do* have available? I've run phpinfo() and gd_info() which I hope is enough to tell some wise person...
2
3077
by: thecrow | last post by:
Alright, what the hell is going on here? In the following code, I expect the printed result to be: DEBUG: frank's last name is burns. Instead, what I get is: DEBUG: frank's last name is burns. Here is the code: $frank = "burns";
220
18993
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have any preconceived ideas about it. I have noticed, however, that every programmer I talk to who's aware of Python is also talking about Ruby. So it seems that Ruby has the potential to compete with and displace Python. I'm curious on what basis it...
699
33862
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro capabilities, unfortunately. I'd like to know if it may be possible to add a powerful macro system to Python, while keeping its amazing syntax, and if it could be possible to add Pythonistic syntax to Lisp or Scheme, while keeping all of the...
9
2670
by: Martin Maney | last post by:
In my copious spare time I've been dabbling at getting a computerized version of a board game working. After deciding that tk just made me want to vomit, and wx was like swimming through concrete slurry, and others I have mercifully forgotten about, I stumbled across pygame. (maybe not for the first time; I think I set it aside earlier because it was described as being aimed at a different sort of game, and besides, I had hoped wx might...
92
6441
by: Reed L. O'Brien | last post by:
I see rotor was removed for 2.4 and the docs say use an AES module provided separately... Is there a standard module that works alike or an AES module that works alike but with better encryption? cheers, reed
3
2418
by: Ron_Adam | last post by:
Ok... it's works! :) So what do you think? Look at the last stacked example, it process the preprocess's first in forward order, then does the postprocess's in reverse order. Which might be usefull. Interesting in any case. Making decorators with this class is a snap!
12
11145
by: Dario | last post by:
The following simple program behaves differently in Windows and Linux . #include <stdexcept> #include <iostream> #include <string> using namespace std; class LogicError : public logic_error { public: string desc;
30
15428
by: James Conrad StJohn Foreman | last post by:
After 3 years of using DB2 on Linux, I'm leaving my current employers to go work for a SQL Server shop instead. In order to find my replacement, they're trying to put together a set of questions to get both some understanding of how wide candidates knowledge is, and how much DB2 specifics they know. Of the questions below, how many do you think are useful in determining if you've got somebody capable of keeping a DB2 instance up,...
2
1631
by: yogesh | last post by:
char TCGI::x2c(char *what) { register char digit; digit = (char) ((what >= 'A' ? ((what & 0xdf) - 'A')+10 : (what - '0'))); digit *= (char) 16; digit += (char) ((what >= 'A' ? ((what & 0xdf) - 'A')+10 : (what - '0'))); return(digit); }
0
8347
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8792
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8694
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8457
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8571
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6157
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4143
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1905
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1585
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.