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.
Here's my goal: 1) to set up a 7 column table containing a list of 147 numbers from a recordset (StNumberRS) and 2) to compare those numbers to a separate recordset containing a partial list of those numbers (completedStores).
If one of the numbers in the completedStores list matches a number on the StNumberRS list show the 'icon_yes.gif' image, otherwise show the 'icon_no.gif'.
I can loop through the StNumberRS and set up the 7 column table, but I'm stuck trying to loop through the completedStores list while inside the StNumberRS loop. Could someone look through my code and see where I've gone wrong? Code:
I am trying to find distinct hostname. And my code is:
sql="select distinct a.Hostname, b.Productname from TableInventory as a, TableProduct as b, TableModel as c WHERE a.ModelId=c.Model AND c.ProductId=b.ProductId" rs.open sql, cnn
After which im suppose to get the indivual hostname's productname, qty and cost. i tried to split up the rs into array values Code:
I have created the following code to create the recordset rsToBeApprovedLocalItemID. Unfortunately, the for next loop works properly only on the first cycle. The response.write(arrToBeApprovedCatSub(0)&arrToBeApprovedCatSub(1)&"<br>")works for each loop but the SQL statement sqlToBeApprovedLocalItemID returns a populated recordset only on the first loop.
On subsequent loops it is empty even though the arrToBeApprovedCatSub(0) and arrToBeApprovedCatSub(1) are alive and well. What's going on? This is truly weird behaviour. I have not come across something this funky before. Code:
I am trying to filter a table of users to select only those records whose roleID matches a value in an array. There could be any number of IDs held in the array from one to a few hundred. The array is generated by splitting a comma delimited memo field from a second table in an Access DB. I can split the memo field OK, I can response.write its values, but what I now want to do is add a value from another table to my reponse write loop. Code:
Last week, my shopping cart was still working well until I began getting the following errors 2days ago..
Error Type:
ADODB.Recordset (0x800A0BCD) Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record. ../order/saveorder.asp, line 157
Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
Page: GET /main/saveorder.asp
Could you check my code below and let me know what possibly the error is?
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.
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
I have it at the moment that on the main default.asp there is a recordset that will display all records within that table, these are a list of forums that will be available.
I have a table that will show the forum name, and the description. This table is then looped using Do while not, now what i need to do is show how many records in the Treads table are related to each forum using asp. Code:
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?
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.
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
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.
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?
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, "'", "''"))
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.
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)?
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:
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.