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:
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.
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("..."))
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:
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?
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").
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.
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?
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").
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?
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:
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?
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
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?
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
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 ...
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.
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:
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.
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.
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?