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'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 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 am trying to creating a function to find a record that was entered in a database. I have created the add button with no problem and it works. The links are:
Text file
ASP file
When I placed the script in the code (lines #524 - #547), I now get an error message looking for an "end" statement. Before this everything worked fine. If I have and "else" statement after closing the form and and "else" statement after opening the recordset, I don't understand where I need the "end statement."
I just got an odd result when I tried to split() a string that didn't have the delimitor in it...it looks like an array without any elements (which is weird - I've never seen one of those in VBS).
UBound says the upper bound on the array is -1, but isArray() says that it is indeed an array. Is there an easy way to check for this condition (or do I have to do both isArray AND UBound)? My VBS docs say nothing about split() returning an undefined array nor UBound() returning a -1. What the dilly, yo?
Subscript out of range: '[number: 0]' or Subscript out of range: '[number: 1]' or Subscript out of range: '[number: 2]'
This is correct in that the variable is empty if user does not fill in correctly. However how do i stop it falling over and just get it to error handle?
e.g. If Subscript out of range: '[number: 2]' empty how do I 'know' this without an error? Code:
I got a problem while running an application. The code for this is as follows:
aList = Split(strMsg,";") For nX = 0 to UBound(aList) strarry=split(aList(nX),"_") var_year=left(strarry(2),4) var_month=mid(strarry(2),5,2) var_day=mid(strarry(2),7,2) var_date=var_day&"-"&var_month&"-"&var_year var_time1=mid(strarry(2),9,2) var_time2=mid(strarry(2),11,2) var_time=var_time1&":"&var_time2 set rs1=conn.execute("insert into tbl_BackupfileInfo(Filename,Createddate,Createdtim e)values('" &aList(nX)&"','"&var_date&"','"&var_time&"')") Next
while runnig this application some times it works fine .But some times it giving an error
Error Type:Microsoft VBScript runtime (0x800A000D) Type mismatch: 'UBound'.
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?
I'm trying to create a table summary from SQLServer. There are ten questions that the user must answer. I can create the ten arrays, np, but I'm just thinking, say Question 9 never has anyone answer with the value 1, then the following step in the code (the way I see it) would fall on its face. There are two ways round it that I can see. Test for an empty array 'index', i.e if Array9(1) = "" then ... But my question is this, is there a way to initialise an array so that all it's values are zero? This would solve the need to test for "" later.
dim app_ids, irowloop, icolloop app_ids = get_app_logins(session("stremail")) for irowloop = 0 to ubound(app_ids, 2) for icolloop = 0 to ubound(app_ids, 1) response.write(app_ids(icolloop, irowloop) & ",") next 'icolloop response.write("|") next 'irowloop
That returns:
0,0,bobsmith,pAssWord,|0,71,tom,tom,|0,71,tomf,pAs sWord,|1,5,tom,a1,| Is it possible to remove the final ',' before the '|' ??
What I have is a recordset listing out a group of names. I've retrieved the field that lists the id numbers for the array and split them to a list. Then I want it to loop through the names listing trying to highlight the ids that need to be hightlighted.
What I am getting is my list repeats the names according to how many ids are in the array. So if I have 2 numbers in the array I see every name on the list twice and the two that I need selected.
I want the list to show the names one time with the correct names selected. What is wrong with this code? Code:
Is there a performance advantage to parsing thru a recordset verus using an array?
I'm currently trying to populate a listbox by returning data from my database, then either parsing thru the recordset until I reach the EOF, or putting the data into an array.
Is it possible with ASP to use arrays with names (e.g user("username") = "ble") instead of numbers (e.g user(1) = "ble")?(I do know of the dictionary object, but is it wise to use that 7 times or more a page?
I'm trying to figure out if there is an easy way to combine the contents of two arrays into one array. Order does not matter, I just want them all together. I'm sort of new to working with arrays, so I don't know if there is a really basic way to do this.
I have an array of product names what I am storing in a session variable.I am looking at being able to delete a specific item but am having trouble acheiving this. I am retreiving the Session variable and initialising it to a new array, then I want to copy this across to a new array apart from the item that I want deleted. I am having difficulty creating an array using a variable as the new array length. Code:
I have one ASP and sends XML data to another ASP which returns Data from a Database. Pretty straight forward, however the XML string is quite long and I would like to pass it to the second ASP via a POST rather then a GET. Problem is that the only way to retrieve the data is to use the BinaryRead method of the Request object.
This data is only text, but I can not find any reference of how to use the data once I have retrieved it?how do I access the Data from the REQUEST.BINARYREAD?