Array Puzzle
I have an array that looks like this:
a(1) = "A"
a(1) = "A"
a(1) = "A"
a(1) = "A"
View Complete Forum Thread with Replies
Related Forum Messages:
Connecting To Database Puzzle
I have these two line of code Set obj = Server.CreateObject("ADODB.Connection") obj.Open "bmtb" Now I understand that "bmtb" can be a server-side include file and have information including a path to the database. The connection works fine, but for the life of me I can't seem to find the SSI anywhere in the project. By the way this is someone else's project I have become responsible for. where the file could be hidden? It's not under "bmtb". Is it possible bmtb is some kind of ASP keyword? (grasping at straws here).
View Replies !
Rebuilding Of An Array From An Existing Array
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 !
Array Integers Vs Array Variables
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 !
Create A New Array From An Array
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 !
Array In Sql
i want to excute given logic select * from Product_Table where Product_Code in ARRAY i.e i want to select Product_Code from VB array and not from a query is it possible.
View Replies !
Array
I know I can do this programatically using a loop but I thought there might be some easier or more effective way. I am trying to invert an array. i.e. array1 = 1,2,3,4,5 but I want to get array2 = 5,4,3,2,1 Is there something like array2 = invert(array1)?
View Replies !
Array
I have to following code:Code: dim arrRes(9),getal,som arrRes=Array(4,4,4,4,4,5,5,5,5,5) for getal=0 to 9 som=som+arrRes(getal) next response.write("Het klasgemiddelde is " &som/10) I get a type not match error on the second line
View Replies !
ASP Array?
I have a page in my admin system where the user can edit products they have added. The problem I am having is with Related Products. These are all listed in a multiple list. What I need to do is have those selected when the product was added, already be highlighted in the multiple list on the product edit page. Here is my post from another forum. Code:
View Replies !
Array
For some reason, when I try to run the following array, I'm getting an error: dim cat(0) cat(0)="0407" cat(1)="0102" 'I will be adding more to this array, but just trying with two for starts. for counter = 0 to 1 itno=cat(counter) 'I get an error when it runs through this function Function rightvar(theVar,lengthNeeded) Dim sResult sResult=theVar if Len(theVar)< lengthNeeded then sResult= String(lengthNeeded - Len(theVar)," ")& theVar rightvar=sResult End Function Can someone help me understand why?
View Replies !
Array
The problem is that in my 5 years of programming in various languages i have never really understood arrays (DUMB @$${lol}) What i want to do is offer an advanced search of a database table on my website. I currently offer the functionality so that the whole of the database can be viewed within the web page so that it doesn't need to be downloaded/need access to view it. What i need to do is run a script that takes all of the column headings that i have and put them into an array. Then with the array i need to output each element into a drop down box.
View Replies !
Asp Array
Ok what I have is a little script which runs through my stock compares how many of one item we have compared to what we need and displays the out come. What id like to do is make an array with the item name so lets say If how many is needed is greater then 0 then add the name of that consumable to an array and move on until the end. Then I want to use the arry to display each consumable on an order form. Anyone have any idea how to do this in ASP or can give me any advice on a better way to do it?
View Replies !
Array
I am doing the following: Code: dim n n=4'ubound(arrsequences) response.write "n:" & n dim arrproductNames(n) dim arrproductSeq(n) and getting the following error: Microsoft VBScript compilation error '800a0402' Expected integer constant process.asp, line 33 dim arrproductNames(n)
View Replies !
Add Something To An Array
How can I add something to an array, e.g [VBS] Dim MyArray MyArray = Array("Item 1", "Item 2", "Item 3") 'Do some code here 'I now want to add another item to my array, how? [/VBS]
View Replies !
An Array
Is there a way of determining whether or not a value or values are present in an array. Is there something nice and easy as with php's if(in_array($SomeValue,$myArray)){ echo "The value is here"; } else{ echo "The value is not here";
View Replies !
2D Array
im trying to write a script that will allow me to take names and addresses from a coma delimetered text file and insert them into a db. ive managed to come up with this script which deals with works well if i only have names in the text file. ie: bob smith, peter smith, brian smith but now i want to do something simular with a text file formatted like so bob smith, bob smiths address, peter smith, peter smiths address, i think i have to use a 2 demensional array but really have no idea how to go about it. any help appreciated. here is what i have so far. Code:
View Replies !
Array
I have a form that has fields named Title1, Title2, and so on to title 12 I want to set up an array that goes through all the input feild values that I already put into variables such as Title1, Title2...so on. It then replaces ' with '' so the apostrophe can be entered into the database. So it: Creates an array by looping through the variables that get the form feilds. Then loops through the array and replaces the ' with '': Title1=(Replace(Title2, "'", "''"))
View Replies !
Array
I'm looking to make an admin page for a web photo gallery, and I need to make a drop down menu showing all files in a given directory that do not have comments in a database for the given filename. I'm curious about the most efficient way to do this. I don't want to query the database separately for each file as this would be horribly inefficient. I'm thinking about two arrays, one containing all filenames in the photo directory, and one containing filenames from the database that have descriptions. Is there a simple way in ADO to do a set operation on arrays, that is to produce array C that has all elements in array A that are not contained in array B?I can do this with while loops, but there must be a better way.
View Replies !
2D Array
Can someone tell me how to do add a 2D array in a table this is how my tables looks like OrderID Product_Code Product_Item Size Color Logo Price Unit Total
View Replies !
Array Value
How will I replace the array values from database to this javascript static array value? Quote: var photos = new Array('Blue hills-01.jpg','Sunset-01.jpg','Water lilies-01.jpg','Winter-01.jpg');
View Replies !
Add Value To Array
I am editing an old mail script that uses a a sendTO array to designate who actually gets the email. I want to add a value (an email address) at the end of the array so it is sent the same mail as any mail that goes through the form(teh form has one huge dropdown list now). I just don't know how to simply add the value to the bottom of the list Any clues (i found some examples but there was way to much extra code that i was having trouble sifting out)?
View Replies !
Array
I'm working on a project using arrays like this: thisArray = array("value1", "value2", "value3") It's seems to work great, but now I'm confronted with adding to that array at a later point. How can I add to an existing array?
View Replies !
Populating An Array
I have two recordsets that I want to populate within an array. The array will always have two columns, but the number of rows is unknown (sometimes 2 rows other times 200 rows). I'm not too familiar working with arrays. I want populate the array using a loop. How would I define and populate the array within loop so that I don't lose values and each new set of values are populated into the array through each iteration of the loop? Code:
View Replies !
Getting Values From Array
for i = 2 to NOD newdate = DateAdd("d", 1, newdate) strdate = strdate & newdate & ", " next MyArray = split(strdate, ", ") I have the above code written in one of my asp pages, the date array is splitted, but how do I get the first and last date assign to a variable..... int min = MyArray(MyArray.Length-1) int max = MyArray(0) I got this code from the web, however it gives me an error: Code: Microsoft VBScript runtime error '800a01a8' Object required: 'MyArray'
View Replies !
Cookie Array
Is there a way to store an array of information in a cookie? ie. a user can have a "x" long list of a variable stored in a cookie, so when they return to the site this information can be retrieved.
View Replies !
Array Entering Into DB
I have two tables, one called tblManufacturers and one called tblModels. tblManufacturers is already populated but now I have to enter the following models which correspond to the ID of the manufacturer into the tblModels table. Any ideas of how I can do this. Code:
View Replies !
Using Array In Session
i am using asp and vbscript. when using the array variable from session i get "Script out of range" error. the code is dim arry() arry = session("myarry") for i = 0 to ubound(arry) ---------------- next i have used this variable in where clause in sql.
View Replies !
2 Dimension Array
I like to declare a 2 dimension array by assign value to the array... I'm not looking for this.. Dim myArray (1,2) myArray(0,1) = "One" myArray(0,2) = "One.1" myArray(1,1) = "Two" myArray(1,2) = "Two.1" but the same way do of declaring 1 dimension For example. Dim myArray myArray = array("One","Two","Three") So, using the same way, how do i declare 2 dimension array??
View Replies !
Setting Up An Array
im trying to set up an array of database records. i want to be able to display all information but only display the request numbers once for each number...while displaying all seq number's associated with each request number. ex: request # seq number instead of 500 1 500 1 2 500 2 501 1 501 1 2 501 2 3 right now, it works so that the request numbers are printed out for each seq number....i've marked the section of code where the problem is being caused...i think it's in the way im trying to set up the array. Code:
View Replies !
Database Into An Array
I have a database of Company titles that I want to grab from an access database, put into an asp array and then pass it to javascript so I can output it into a CSS styled javascript menu. Right now I am stuck on how to exactly put the database entries into an asp array. Below is what I have so far. So I want it to return distinct entries from the Title field and put it into the array called Titles after the asp code has done an HTMLEncode to make sure I can also pass it along to another asp page. Basically I need to know what to put after the Do While NOT Rs.EOF. Code:
View Replies !
Array/recordset?
query database results to recordset results to array using GetRows update values in one column in array <BOING> realised you cant sort an array easily..."hmmm, perhaps if I put the array contents into a recordset I could sort them" <DUH> The above seems pretty stupid to me, ie, recordset, to array, to recordset - where finally I *will* actually need them in an array anyway.... So, is it possible to update a recordset once its pulled from the database? It's probably a stupid question, but its not something I've ever done before so wasn't sure? If so, a small example would be handy... I'm basically calculating a field which needs to be stored back against the row whilst iterating through the whole lot.
View Replies !
An Array Problem
I want to create an array which is created in a do while not loop but it come up the Error Type: Microsoft VBScript runtime (0x800A000D) Type mismatch: 'MyArray' /docket_Local/ukstock/processscanin_non-uniqueitems.asp, line 65 code below: i = 0 do while not rs.EOF MyArray(i) = rs("fldLocationDesc") i = CInt(i) + 1 rs.MoveNext loop
View Replies !
Array Problem
Does anyone know whats wrong with this? When ever i try to access the first key in the array, it gives me this weird error: ADODB.Field error '80020009' Object is no longer valid. ? Code:
View Replies !
2-dimentional Array
I try to store a two-dimentional array in a session variable. When I do the same with a one-dimentional array, it works fine, but with a two-dimentional array it fails. Is this not possible? Is there something special I have to take into account?
View Replies !
Count Array
I am trying to work out how I can count my arrays to compare the number of values. Code: ArrID=Split(Request.Form("ID" ),"," ) ArrData=Split(Request.Form("Data" ),"," ) if count(ArrID) = count(ArrData) then Do Stuff else Assign Failure Value
View Replies !
Searching Over An Array
I have a single column that outputs a comma seperated list of values (black, white, red) I created an arrary to output the values Dim colorTypes, arrTypes arrTypes = split(objRS("types"), " ") riceTypes = REPLACE(objRS("Types"), ", ", "<Li>") response.Write "<Li>" & colorTypes This works fine. Now, I need to compare a queryString to arrTypes and bold the match before outputting it.
View Replies !
Group Array
I have several arrays, created by splitting a string of comma delimited values, as follows: arrOne = split("1,2,2,2,3,6,3,7",",") arrTwo = split("5,2,1,6,5,5",",") What I want to be able to do is to group the arrays so that I know how much of each there are. I need to output results in the following format: Number / HowManyTimesThatNumberOccursInTheArray. So for example, the above would output: ArrOne: 1 / 1 2 / 3 3 / 2 6 / 1 7 / 1 ArrTwo: 1 / 1 2 / 1 5 / 3 6 / 1 These can literally just be output as a string if needs be. Is this possible? If so, how do I go about achieving it?
View Replies !
Looping Thru Array
I need to look at each element in an array to write it to the web page, one element at a time. The previous page contained a form of dynamically created checkbox sets. The number of checkbox sets will always be unknown. Anyway, here's my question: I've tried different code (due to circumstances that would be to lengthy to get into here, I need to use vbscript, be able to use javascript within vbscript code. Here are examples I've tried and the results: Code:
View Replies !
Javascript Array
I wonder, does anyone know of any resource or suggestions of how to use ASP to access a MS Access DB, and create an javascript array from the results. Let me explain: - If i had a access db with one colum, consisting of single keywords. Then I want to create a javascript array at certain intervals, as the db content changes. I suppose I would run a query on the db, and response.write the javascript.
View Replies !
Empty Array
I am working with an array that I am populating off my database. However, in some instances the array will be empty. Is there any way to determine an empty array besides ubound = 0 (which might mean 1 record in included)?
View Replies !
Array Of Files
I want to loop through all the files in a folder and add their names to an array. How can I get an array to do this without knowing how many files are in the folder to start with?
View Replies !
Size Array
I have a variable named numdata that contains an integer value. Now I want to create an array with the size of numdata. Example: If numdata is 25, then the array should be test(25). Unfortunatly test(numdata) doesn't work.
View Replies !
An Array Problem?
I am experiencing a problem with the message field of a form, and suspect it may be array related. If I type in a random message - or deliberately leave the message field blank - the form tell me (highlighted in red), that I have an error with the message field. I am pasting the relevant parts of the code here, in the hope somebody can throw some light on what doesn't look right: Code:
View Replies !
Sql Statement As Array?
At the moment I'm quite happy to create a Sql string based on user selection, but find it quite cumbersome. What I was considering, Say for example you had the basic Sql statement... SELECT * FROM Table What if you set that to an array that represents something like.. [ACTION] [TARGET_COLUMN] FROM [TABLE] eg 'create the array with 3 Columns 1 Row Dim myArray(3,1) myArray( 0, 0 ) = SELECT myArray( 1, 0 ) = * myArray( 2, 0 ) = Customer You could add more columns such 'AND' 'OR' 'DISCRETE' etc who knows, depends on how crazy you wanted to get I guess. Maybe Im just in an array phase (I'll grow out of it) or would this allow quite a felxible way of manipulating an Sql Statement, and prompts the question would it really be worth the 'effort' should it work? Code:
View Replies !
Session_OnEnd On Array
Why this code is not executing the Session_OnEnd on the Array? Sub Session_OnEnd dim pArray pArray=Application("ref") for b=1 to 100 pArray(b)="" next Application.Lock Application("ref")=pArray Application.UnLock
View Replies !
ASP/Checkbox Array
I have a form with checkbox array and I am using the database to give uniqe values to the checkboxes. This form shows some of the checkboxes are already checked based on certain criteria. When the user checks the check boxes I am able to get the ids of that record and be able to update the database. But when the users uncheck the check box that already checked, I am not getting anything when I do response.write. So I have no way of knowing which check box is unchecked and so I can't update the database. Is there anyway I can get the values of the unchecked checkboxes? Or there any method that I can use to make my form work?
View Replies !
String To Array To DB
I'm such an idiot. I used to actually be good at this ASP stuff. Ah well. I have a string, for instance: 40, 43, 1, 2, 3, 60, 64, 65, 66 Which I need to get into the DB as individual numbers... Any clue how to do this quickly and easily?
View Replies !
Array Sorting
I need a array with x numbers (1 to x) mixed. Like this: Using 4 numbers (1 to 4), i need: array(1) = 3 array(2) = 2 array(3) = 4 array(4) = 1 This is random. I make this: Code:
View Replies !
|