Creating And Referencing Multidimensional Arrays
I'm just confused because I'm obviously calling the code wrong but every tutorial I find makes it seem like I'm referencing the multidimensional arrays correctly so I don't knwo what I'm doing wrong. Code:
View Replies
ADVERTISEMENT
I am coding an ASP script, which currently requires a 5-dimension array, i.e. array(a,b,c,d,e)
I remember reading somewhere, a long time ago, that there is a limit to the number of dimensions in ASP. That was a long time ago, and I don't remember.
View Replies
View Related
I get error when I try to ReDim and Preserve a Dynamic Multidimensional Array. Code:
View Replies
View Related
I am currently using arrays to store values that a user inputs into text fields which represent cells in an access table. I am currently coding them like this:
*********
HomeScore = Array(0,1,2,3,4,5,6,7)
HomeScore(0) = Request("Home_score1")
HomeScore(1) = Request("Home_score2")
HomeScore(2) = Request("Home_score3")
HomeScore(3) = Request("Home_score4")
HomeScore(4) = Request("Home_score5")
HomeScore(5) = Request("Home_score6")
HomeScore(6) = Request("Home_score7")
HomeScore(7) = Request("Home_score8")
*********
And then later refering to these values using a for loop like so:
*********
For x = 0 to 7
strsql = "Update CUPFirstRound Set Home_Score=(" & HomeScore(x) & "),...
conn.execute(strSQL)
Next
*********
I know that it is possible to shorten this cpodiong using the Ubound function but i really dont know how to use it and i cant find any where useful on the net that explains it how i need to know.
If anyone can help me from what they see above then it would be Really appreciated, if you need more code just let me know. I didnt paste the whole code because that is pretty pointless because its virtually all the same except for the names of the arrays and the fields it is requesting (Request("..."))
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 have a HTML control generated by the following:
INPUT TYPE="hidden" NAME="MyAnswer" VALUE=""
Is there a way to reference the Value of this control using VB program code???
View Replies
View Related
I have a need to pass a url via the address field to a page - i.e.
page.asp?myurl=newpage.asp.
When I get the QueryString object for "myurl" it correctly comes back
with 'newpage.asp'. However, if I pass an anchor name on the url -
e.g. page.asp?myurl=newpage.asp#myanchor - the result is still just
'newpage.asp'.
Is there a way to pass the anchor link into the page and get access to
it?
View Replies
View Related
I am trying to run a Session_OnStart Script based on a Session variable that is created on a .asp page. The problem is that when I reference the Session in Global.asa It has no value but it has a value on the .asp page level. Is there a certain way that I have to reference a Session in Global.asa?
What I have is somthing like the following:
Sub Session_OnStart
If Session("NIS")<> "" Then
Run The Routine
End If
End Sub
Based on the above the routine does not run because Global.asa does not seem to get the value of Session("NIS").
View Replies
View Related
This line of code works fine when the database is in the webroot folder:
DataConn.Open "Driver=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("LessonsDatabase.mdb")
but when the asp file containing this code is in the webroot but the database is in a subfolder called db. I dont know how to reference it relatively. PLease help! I'm sure this is very basic to anyone in the know.
View Replies
View Related
I am trying to do some client-side form validation using vbscript. The form consists of 15 rows, with five fields in each row. For example, I want to be able to look at the contents of the 3rd field in the 9th row. How do I reference that field using vbscript? Do I loop through a collection?
View Replies
View Related
I am trying to run a Session_OnStart Script based on a Session variable that is created on a .asp page. The problem is that when I reference the Session in Global.asa It has no value but it has a value on the .asp page level. Is there a certain way that I have to reference a Session in Global.asa?
What I have is somthing like the following:
Sub Session_OnStart
If Session("NIS")<> "" Then
Run The Routine
End If
End Sub
Based on the above the routine does not run because Global.asa does not seem to get the value of Session("NIS").
View Replies
View Related
I actually work with multidimensional array (the static or dynamic one)
I've read through to use:
STATIC
=====
dim array01(2,2)
which will make an array of
(0,0) (0,1) (0,2)
(1,0) (1,1) (1,2)
right?
for DYNAMIC
=========
redim array02(2,2)
which will make exactly the same as above, but in dynamic we can extend them, right?
okay... now assume I would like to have value inside array:
array01(0,0) = "some word"
array01(0,1) = some_integer
can I do it? because when I tried to do
====
dim array01(2,2)
array01(0,0) = "test"
array01(0,1) = 5
====
it returns an error:
================
Microsoft VBScript runtime (0x800A000D)
Type mismatch
================
How do I tell ASP that the specific variable is INTEGER, or CHAR or STRING? and How do I manage my problem?
View Replies
View Related
I am trying to sort a multi dimensional array but am getting an error. Can someone please help me out. Here is a sample of the array (it is created dynamically from the db): Code:
View Replies
View Related
is there any way tohave an array where the first subscript is dynamic and the second subscript is static
View Replies
View Related
i have a sorted array of 43 columns. dynamically altered the array and added a new row to the existing array. i need to sort the array based on 2nd column. how to sort a multidimensional array?
View Replies
View Related
I am wondering if its possible to load two array ad use one as item title and the other as value, ex:
array1 = "Sally, Jason, Jackson, Marie"
array2 = "24, 54, 21, 33"
For ....
TempSally(Sally) = 24
TempJason(Jason) = 54
....
Next....
View Replies
View Related
I have a multidimensional array with 5 keys. I need to perform a alpha sort on the 3rd key. Does anyone have an example on how to do this?Here is an example of what my array consists of:
mArray(i,0) = '2007-05-02"
mArray(i,1) = "6:00pm"
mArray(i,2) = "TEXT TEXT TEXT" <------------------ NEED TO DO ALPHA
SORT ON THIS KEY ----------------<<
mArray(i,3) = 6
mArray(i,4) = 4
View Replies
View Related
I have a multidimensional array that is actually 1 dimension (it comes from a recordset.getrows that returns 1 column). My goal is to put every single line of the recordset in a textfile. currently, here is my code Code:
for i = 0 to UBound(Res,2)
fileContent = fileContent & res(0,i))
Next
createTxtFile(path,fileContent)
I have 5000 lines and it takes about 10 minutes. I was thinking of doing a Array.Join but I don't think that works with multidimentional array. Also thinking of converting my useless multidimentional array into a sing dimensional array but how?
View Replies
View Related
Hello all,
I am extremely stuck. I am trying to create a simple shopping cart yet keep running into the same type mismatch error everytime, no matter what I do. I have read countless articles about this, even posts in this forum, I've followed their code exactly and still I get the same error.
In the global.asa i am trying to create a multidimensional array with just two columns, product id and quantity, keeping it simple for now.
global.asa
SUB Session_OnStart
CONST CART_COLUMNS = 1
Dim cartArray()
ReDim cartArray( CART_COLUMNS, 1 )
cartMaxUsed = -1
Session("cartArray") = cartArray
Session("cartMaxUsed") = cartMaxUsed
END SUB
Now in my subsequent asp pages I have created functions to add to the array, following code exactly from articles, posts, etc., but everytime I would run them, it would fail on a type mismatch error when I tried to get the UBound of the array.
Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'UBound'
/store/add.asp, line 10
So just for testing I simplified it as much as possible and it would still fail on the same line of code. Here is the code for add.asp
Dim cartArray
Dim cartMaxUsed
cartArray = Session("cartArray")
cartMaxUsed = Session("cartMaxUsed")
dim num
num= UBound(cartArray, 2)
response.write num 'for testing purposes
response.end 'only
everytime it fails at the UBound line.
View Replies
View Related
i use this script to generate download links from directories which are first passed to an script to record the number a link is clicked.
the function is calle with a path like:
ListFolderContents(Server.MapPath("/dir1"))
my question now is: can i write this to an multidimensional array (or object oriented?) - and then sort it by date ?? if so how ? Code:
View Replies
View Related
I'm not sure how to best describe my problem, so a simple example should help explain things:
I have two arrays, called set1_data and set2_data
if I create a variable like so:
firstPart = "set1"
and then assign like this:
copyOfArray = firstPart & "_data"
how do I make copyOfArray reference the set1_array, as opposed to just a string "set1_array" which is what it's doing?
I've had a good rummage round ye olde Internet but couldn't find anything there must be a keyword or function to achieve this?!?
View Replies
View Related
I have trouble working with arrays in asp.. I have the following error :Microsoft VBScript runtime (0x800A0009)
Subscript out of range: '[number: 0]'
the line that gives me the error is the following:
Door_OpeningValH= aDoor_OpeningVal(0)
and my code is this:
Door_OpeningVal= rs("Door_Open_Dimension")
aDoor_OpeningVal = split(Door_OpeningVal, "x", -1, 1)
Door_OpeningValH = aDoor_OpeningVal(0)
aDoor_OpeningValW = split(aDoor_OpeningVal(1)," ",-1,1)
Door_OpeningValW = aDoor_OpeningValW(0)
Door_OpeningValUnit = aDoor_OpeningValW(1)
what i'm doing is recivieng values from 2 textboxes and a combo box.I want it to save in my database like this:
2x5 ft
View Replies
View Related
I need to create a multidimensional array using another int as one of the criteria but I keep getting probs with my code, what am I doing wrong?
Code:
intMonthName = Cint(Month(field_in_my_database))
Dim myarray(intMonthName,2,5)
I get this error message:
Quote: Microsoft VBScript compilation error '800a0402'
Expected integer constant
View Replies
View Related
I am using ASP with VBScript and I want to know how to seperate a 2 dimensional array into 1 Dimensional arrays:
like if
MyArray is a 2 D array and I want to store the first row of this array in another array , like in C
MyArray[5][5] //this is a 2D array
OneDimArray=MyArray[0] // stores the first row of the 2D array in OneDimArray
is there a way to do it in VBScript ????
I couldn't find a way
I don't want to do it with loops I hate code with too much loops,
View Replies
View Related
How can display unique values from an array. I dont want to loop thru all the values and do it. Is there a better way?.
View Replies
View Related
What does the numeral '1' mean in the following statement?
For J = 0 to UBound(QArray, 1)
View Replies
View Related
I have an array in ASP and I am populating the array with the values from database on checking a condition. Lets say i have array of arr(5). Initially I made all the array items null ...
View Replies
View Related
I have an array in ASP called WordsArray() which contains several words. What I would like to do is search the array for a word, and if its not there, add it to another array ResultsArray()
So far, a loop in my code only checks the current array value, and not the rest of the array, adding the search word to the end of the resultsArray regardless.
View Replies
View Related
I have two related tables in my database. One stores events and the other stores a list of key topics.
I have an interface set up where users can add / edit events.
In the add event page, I am querying the "key topics" table and returning them as options (array of checkboxes). The user makes their pick, and submits. All the data saves in the 'event" table, including the primary id of the "topics".
That part works great. The problem I am having is when the EDIT event page resolves, I am trying to "check" the options that were previously saved.
First thing I do (at the top of the page) is to query the events table to pull all of the data out. I use the 'events" table to do this.
For the checkboxes, I am once again looping through them in a query that uses the "key topics" table. So the boxes are displayed, but I can't seem to get the logic right to have the appropriate ones checked. here is my current code:
View Replies
View Related
i want to create a dynamic list or array in asp as we have arraylist in asp.net. what i want is that i want to hold the values selected by the user in a list and in advance i dont know that how much values the user will select. i also tried to use array with redim but that did not work as we can create array with only constant integer parameter.
View Replies
View Related
at the moment i am creating a shopping cart of sorts. Simply the user selects the check boxes of the items he wants and clicks submit. The items are dynamically created and they could select anything from 1 to 100 items..
so processing the form is clear not possible by hard coding. How could i read all the values from the POST into an array instead of processing each item at a time.
View Replies
View Related
I have a string that looks like this: a|b|c|d%e|f| ...
I split once on "%"
ar1 = Split(Mystring, "%")
then when I try and split the ar1 by
ar2 = Split(ar1, "|")
I get error '800a000d' Type mismatch
I have tried
ar2 = Split(Cstr(ar1), "|")
How can I split this string?
View Replies
View Related
I have run into a unique issue, what I want to be able to do is store a collection or array into a database or xml file. The main reason for doing this, is I don't want to use Sessions as they are volatile to server hiccups or resets. I don't want to use cookies as they are insecure, but I will use one cookie to store a UniqueID to relate to the data in the database or XML file.Can anyone think of a way to store an array in Access, MySQL, or XML file?
View Replies
View Related