ADODB Versus 2-Dimensional Array
I'm working on developing (yet another) shopping cart for my work. I was wondering if anybody knows which approach leaves a smaller footprint in memory on a server: an ADODB Recordset which stores arrays one-dimensional arrays or a two-dimensional array?
We are currently hosing our web site on a shared machine at Verio. The cart I have to build needs separate carts because a customer's products can come from different locations. Each location will have a different cart. On the cart page itself, I would like to display each cart in a separate location.
Logically, it make the most sense (to me, anyway) to use an ADODB Recordset to manage each individual cart (array) than to write the code to manage the arrays. What are the disadvantages of using ADODB recordset instead of a two-dimensional array in this case?
Which approach would be easier to manage and manipulate? Are there any reasons why I shouldn't use a two-dimensional array? The nice thing about ADODB is that I will not need to program certain features and have access to FILTERS.
Any suggestions about how each approach would scale as site traffic increases? Will one approach bog down the server more than the other? I'm also open to suggestions about a possible, yet illusive, 3rd way.
View Replies
ADVERTISEMENT
If I have an Array declared like this:
MyArray = array (“value 1”, “value 2”, value 3”)
Will this array physically be a long single row or a single column (like below)?
Value 1 value 2 value 3
Or
Value 1
Value 2
Value 3
View Replies
View Related
I need to loop through a two-dimesnional array (x,y) until a value in x is empty or the end of the array is reached, whichever comes first. Example array:
Dim myArray(4,1)
myArray(0,0) = "part 1"
myArray(0,1) = quantity
myArray(1,0) = "part 2"
myArray(1,1) = quantity
myArray(2,0) = "part 3"
myArray(2,1) = quantity
myArray(3,0) = ""
myArray(3,1) = quantity
myArray(4,0) = "part 5"
myArray(4,1) = quantity
In the example above, the loop should stop once it determines myArray(3,0) is empty. If myArray(3,0) was not empty, the loop would continue until the end of the array was reached. Anybody have a code example to do this?
View Replies
View Related
how do I resize a two-dimensional array? The array I'm working with is "data(X)(Y)" where X is 0 or 1 and Y grows to a dynamic number.If "data(1)(highest element)" IsNull, then I need to strike it from the array. I believe this should be doable by simply resizing the second dimension down by one. Through researching I established the following set of code:
I = UBound(data(0)) - 1
ReDim Preserve data(2,I)
But it results in a "Subscript out of range" message on the latter line. Short of looping through and building a new array.
View Replies
View Related
what i want to do is have a (multi dimensional?) array, so that each second dimension represnts a row of radiobuttons. The trouble is i don't know what to name the arrays as. Obviously for each row the names for the different radio buttons will be the same, meaning you can only select one.
in php you could do it with a single array as you name each row of radio button differently:
1st row:
name='array[0]'
2nd:
name='array[1]'
in asp it doesn't look like you can do it this way, because to create a similar array you'd do something like
1st row:
name='array'
2nd
name='array'
then use split in the recipient script. This does not work however, because each radiobutton (on all rows) has the same name, and therefore when you click one all the rest on every row are unclicked..
View Replies
View Related
I understand the logic behind a multi dimensional array (sort of). What I need to do is be able to capture the product information (that is in a product session) that a user has selected and email it to a specific address.
The email coding page is written in javascript. This page is already being used to also send the customer credit information. If anyone has some insight in this I would be very appreciative. Code:
View Replies
View Related
I guess one should declare the array using empty brackets.
Dim MyArray()
Later I set MyArray to:
Redim MyArray(2,3)
The problem comes now. How should I use Redim again? I have heard that only one of the two dimensions can be enlarged or decreased. Is that correct? If so, which dimension would be ok to set to 5 in MyArray. Is ReDim MyArray (2,5) correct or should it be (5,2)?
View Replies
View Related
Okay, I'm doing a project for someone in which random questions are to be pulled and posted so that the user can complete a test/quiz/exam for a grade.
Well, his host apparently doesn't have any database stuff, but I can probably get him to move to another if it's absolutely necessary.
Personally, I'd prefer to stick with files, just because that's what I'm most accustomed with. But if there's a very compelling reason (performance or reliability?) to move to a database, I suppose I could.
Here's a sample of the type of data I'll be using. The format is as follows: Question, Correct Answer, First Answer, Second Answer, Third Answer (If Any), Fourth Answer (If Any). A question is on each line (in this browser window, it may appear that a question is spanning several lines, but it truly isn't). Code:
View Replies
View Related
I would like to know the Pros and cons for using ASP VS Visual Basic for intranet, in terms of time development and customization. The project that we will use it is a basic Information Management System.That could be used for offline and online using IIS and MYSQL.
View Replies
View Related
The default ASP generates the HTML response including several IFRAMES. It takes a long time to load this page. I believe a lot of it is round trips to load the IFRAMES. Couldn't include files be used to increase this performance, so everything is done in the initial call instead of multiple round trips?
View Replies
View Related
what's the differences between readonly and disabled attribute? When I do the post, it couldn't get both values <%= fname %>. any ideas?
<input type="text" name="fname" value="Joe" readOnly>
<input type="text" name="fname" value="Joe" disabled>
View Replies
View Related
how to get and assign the first dimension of a two dimensional array to another array? For example, I have a recordset object (rsObj) and then I take that object and assign to array (via GetRows() method). I would like to take just the first dimension and assign to another array, but I get a "Subscript Out of Range" error.... any ideas?
temp_array = rsObj.GetRows
new_array = temp_array(0)
View Replies
View Related
Does anyone know how to store multi-dimensional arrays in the Application object? And if so please show an example.
Also, how do you loop through multi-dimensional arrays? I just can't seem to get my head wrapped around this.
View Replies
View Related
I would like to know how many rows and columns are created in the following array. Is it 10 rows and 2 columns or is it 10 columns and 2 rows? Dim Array(9,1)
I have searched for some info about it but not found any consensus. Some sources claim that the first number symbolizes the rows and the second number the columns and other sources claim the opposite. I am confused.
What is it really like? How many rows and columns?
Assume that I need an array with 2 columns and 5 rows then how should it be declared (4,1) or (1,4)?
Which is the first dimension and which dimension it the second one? Horizontally (first/second) vs vertically (first/second)?
How are the various elements called, for example how is the element on the first row in the 5th column called. By using (0,4) or (4,0)?
Assume that I want to store first and last names in two separate columns in an array and then expand the array by using Redim/preserve. The dimension I want to expand is the one with the rows because I view the array as a table with two columns.
I know there are certain rules that apply when it comes to using Redim/preserve on multidimensional arrays. Only the last dimension can be changed etc. How could that be done in this case? I am mainly interested in the declaration (1,x) or (x,1), where 1 is the number of columns and x number of rows (that is increased).
View Replies
View Related
I am trying to setup a 2 dimensional array which i can populate on the fly with data coming frtom a database.
I understand that you have to set a specfic size for the array in ASP, but I am looking at making the array dynamic and using the Redim function to increase the size by 1 each time. Code:
View Replies
View Related
I am trying to create a dynamic multi-dimensional array, based on a count from a database. The count is correct, but when I try to Redim preserve my array, I get an error...
Subscript out of range
referring to the line of code...
ReDim Preserve builderArray(CInt(builderCount),5)
How can I do this redim successfully?
View Replies
View Related
When my webserver does not process a user's change because of an invalid password, I inform the user and I want to present them a button for a retry:
<TR id=continuebuttonrow>
<td width="05%"> </td>
<TD width="90%" align=center valign=middle colspan=2>
<BUTTON TYPE=BUTTON
ONCLICK="location.href='<% =Request.ServerVariables("HTTP_REFERER") %>';"
class=btnParms name=btnContinue ID="Button3">Try Again (Back)</BUTTON>
</td>
Yet if this button is clicked, they go back to the server and the page is refreshed with original values.
If I click the browser's BACK button (rather than my button above), I go back to the page (from cache I guess) I want (because it contains the user changes). Here I can correct the password without having to rekey the changes.
So, what is the Request.Servervariable needed for the equivalent of the BACK button?
View Replies
View Related
I encounter a page reload situation in ASP. It is I need a way to differentiate whether the current page - "Application_Result.asp" got reloaded itself when user click on the browserRefresh button or is requested by the previous page "Application_Form.asp".
I tried using
<%if Request.ServerVariables("REQUEST_METHOD") = "POST" then%>
<!--it is requested from "Application_Form.asp, do something-->
<%else%>
<!--Application_Result.asp refreshed itself(such as user clicks on the
browser Refresh button, do something else-->
<%end if%>
However, in both cases, the IF statement above all evaluated as true. how to differentiate this two different behavior (Page Refresh versus Page requested by another Page) ?
View Replies
View Related
I want to understand the difference between submit button and regular button: <input type="submit"> and <input type="button">. My understanding is that submit button will send the entire HTML form to the web server, but regular button won't.
I have a problem that needs to pass HTML elements data back and forth in several ASP pages. I am using regular button to do that. But what's the approaches?
View Replies
View Related
I dump the entire recordset into an array:
If not rs.EOF Then
aEmp = rs.GetRows()
Contents of the array are in this order:
EmpID,EmpName,Indent,Sub_ID,Lft,Rgt,MgrID, LastName
This query sort on the basis of Lft and Rgt columns.
The name of the array is: aEmp.
My question here is how can I get only the LastName from the aEmp array into another array so that I can sort the names alphabetically and then display the employees in the alphabetical order.
Or is there is another way I could this by using the same array while keeping the lft and rgt sort of the query? If I sort based at the SQL query level, I can see the names sorted by the lft, rgt and lastname, but since the lastname is at the end of the sort list - it does not appear alphabetically.
View Replies
View Related
In working with arrays, I have found that I am unable to dimension and array
with a variable that has an integer value but I can redimension one this
way. I haven't see any information that tells me if this is a requirement,
although it appears to be because I get an error if I try it.
Ex.
Dim b
b = 10
Dim a(b) ' this errors out but
Dim a() ' this
Redim a(b) ' works
Code:
View Replies
View Related
I want to create a new array called arrNames2 and copy contents of arrNames to arrNames2.
I then want to loop through my db and add more names (while going through the loop) to arrNames2. What is the best way to do this? Do I have to keep redim the array wehn I add more names?
View Replies
View Related
I was just getting back into ASP... and I realized that their ADODB uses active x... I was sure if it actually triggers the active X bar at the top... would be pretty scary if it did. Does anyone know if it does?
View Replies
View Related
I'm working on a lab for school, and I'm getting the following error while trying to use my ADODB Recordset.
Error Type:
ADODB.Recordset (0x800A0E78)
Operation is not allowed when the object is closed.
/Lab2/Webpages/Lookupraceinformation.asp, line 47
My SQL is working, and the DLL I created in VB is passing values to the ASP page, because I assigned a value of 1 to the function that is to pass the recordset to the ASP page, and when I did a Response.Write, the 1 showed up on the page, so I'm baffled with this one.
View Replies
View Related
I've got a problem with recordset object.
Error type
ADODB.Recordset (0x800A0E78)
operation is not allowed if object is closed. Error is in line 31 .
I attach you the code in orden to have a look!!!!
The problem happends when I use an INSERT statemen; if I use a SELECT statement nothing happends.Which could be the error and solution to the problem?
View Replies
View Related
After the latest security update, is it still possible to use adodb.stream
on the server side?
View Replies
View Related
I'm using JScript locally (no web programming) to read a .mdb Access file.
The .mdb file has a table named Books/Authors, with a slash inside the name as you can see.
My JScript code:
cn=new ActiveXObject("ADODB.Connection");
cn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB;Database Password=""; Data Source=myfile.mdb;");
rs = cn.Execute("SELECT field FROM Books/Authors");
hangs on the rs.Execute command.
I cannot change the structure of the .mdb file, because is part of another project not under my control.
View Replies
View Related
We have an application, written in ASP, that uses the ADODB.Stream to be
able to open files and write byte arrays to the Response object. If one of
our administrators patches the web servers this application runs on in
Windows Update, I'm screwed, right? You've essentially just disabled this
COM object, for not only its evil purposes, but its useful ones?
View Replies
View Related
I have an ADODB.RecordSet that RecordCount alway return -1 and this RecordSet is plenty of record!
R.RecordSet = -1
R.eof = False
R.BOF = False
Is the cursor is lost somewhere?how can I do to get the number of record in the result set?
View Replies
View Related
While connecting to a database using the ADODB connection object,which is the good practice?
To connect everytime you query the database and then disconnect. Set connection object = Nothing OR
To keep the connection open till the session is timed out or user logs out. In between continue to open and close the recordsets.
View Replies
View Related
Code:
<%
Set objDBConn = Server.CreateObject("ADODB.Connection")
strConn = _ "driver={MSSQL};;uid=user;pwd=pass;database=database"
objDBConn.Open strConn
%>
View Replies
View Related
I keep getting the following error message when accessing a web page:
ADODB.Recordset (0x800A0CC1)
Item cannot be found in the collection corresponding to the requested
name or ordinal.
/SNHC/Classes.asp, line 2701
And the line that the error message is point to in Classes.asp is:
RecordsArray = Recordset.Recordset.GetRows(25, ,
Array(TextColumn,BoundColumn))
I've read previous forum, but none of the solution in them seem to work for me.
View Replies
View Related
I am using ADODB.Stream for downloading the files on user machine. The code works fine when filesize is less than 10 MB. But if file size is more than 10 MB then it doesn;t get download. Can anyone tell what is the problem. I have to user some different component.
View Replies
View Related