Problem Filtering Recordset By Values Held In Array
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:
View Replies
ADVERTISEMENT
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
View Related
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
View Related
i have my database in MS Access. a table name products contains fields:
pro_name
no_of_comp
inserting data from form where products field is mutiline text box. split this and store in array then insert records.
now i want to facilitate let user edit their data.
during editing new products are entered with no_of_comp = 1 and already exisiting products gets no_of_comp= no_of_comp + 1.
if user delete product then no_of_company = no_of_comp - 1.
what i want to do is: Code:
View Replies
View Related
How can I remove a value from an array. Like: remove from array where value=bla-bla?
View Replies
View Related
I have an array which has days of the month stored in it. For example at one
time it might have the values
1,2,3,6,7,8,9
at another time it might have the value
4,5,12,14,19,25
These are days of the month that have been selected and read into an array.
What i would like to do is to write them out and put a "X" where the days
were selected Code:
View Replies
View Related
i m getting these value from a query n stored it in an array:
FY2005 P1 (8/1/2005 - 8/31/2005),
FY2005 P2 (9/1/2005 - 9/31/2005) and so on.
i need to use eg
8/1/2005 as startdate and 8/31/2005 as enddate
similarly
9/1/2005 as startdate and ,9/31/2005 as enddate.
and so on
we can split FY2005 P1 (8/1/2005 - 8/31/2005),
FY2005 P2 (9/1/2005 - 9/31/2005) by using split func in vbscript. But how can we use its subparts.i mean 8/1/2005 etc ...
View Replies
View Related
some ready-made code that will loop through the values in an array and sort them in ascending or descending order? I'm about to start building some new functionality that will need to sort the values in an array and then present them in ascending order. My initial thoughts are to loop through the initial array, find the lowest value and then load that value (and all associated values) into a new 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
How can I print the array which has the dumped recordset onto the screen?
Dim rs2
set rs2 = Server.CreateObject("ADODB.Recordset")
rs2.open sub_Emp_Source, Conn
'Dump the recordset into an array
Dim aEmpSubordinates
aEmpSubordinates = rs.GetRows()
Response.Write aEmpSubordinates
View Replies
View Related
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:
View Replies
View Related
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:
View Replies
View Related
I have the following code to check if a field number matches a specific value. here is the code:
View Replies
View Related
I first retrieve the values stored in a session variable (where I have stored an array). Then I assign the session variable to a local array called "myarray".
Assume that "myarray" now contains 5 records. What would the code look like if I want to create a loop that transfers the 5 values from "myarray" into a select box/dropdown list?
How is that done?
View Replies
View Related
I have 24 checkboxes all with the same naming convention, each box has a
value ranging from 1 to 23, what I need to do is fill in the gaps with a
0 value where the user doesn't select a value.
So lets say that the user selects:
1,2,3,4,5,6,7,15,18,19,20
what I want to do is use the split function on the next page to convert
into an array but then I want to redim the array and fill in the missing
values, so I would end up with:
1,2,3,4,5,6,7,0,0,0,0,0,0,0,15,0,0,18,19,20,0,0,0
is it possible to do this and if so how?
View Replies
View Related
I'm again having trouble putting ASP records INSIDE html link.
Here's the string I put inside Access field:
No room number specified (<a
href='contact.asp?subject=corrections/addition for AASG.info group ID
<%=(Recordset1.Fields.Item('group_id').Value)%>'>update</a>)
but it is not working. The link created in my html output puts out asp
part LITERALLY and does not put the VALUE of the recordset.
This didn't work either:
No room number specified (<a
href="contact.asp?subject=corrections/addition for AASG.info group ID
<%=(Recordset1.Fields.Item('group_id').Value)%>">update</a>
View Replies
View Related
I have a recordset which displays a feild with the initial value of 1, I want to be able to increase the value with whatever numer I choose.if I set antall = antall + 1, It increases with 1 nomather what number you put in, how can I make it work the way I want.
antall = antall + ?
View Replies
View Related
I know that cookies can store an array of values, which can be accessed like this:
tempid = Request("cookiename")(i)
Is it possible to use session variables in the same way? Store a array of values in the same session variable and access them on another page by indexing?
I've looked around alot and I've not found anything suggesting that this is possible.
Right now I'm using a single set of cookies to store info on a series of purchaces of the same type of item. I'm hoping to use session variables to replace the cookies.
Does anyone know for certain if this is not possible?
View Replies
View Related
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:
View Replies
View Related
i have a a SQL stored SP bringing out one recordset, I have a loop reading out all the records, what I would like to do it compare each record to the previous one and if it is the same then do something. I'm having trouble figuring out how to do the comparison as I loop through the records
View Replies
View Related
I have two records pulled from the same field in a table, so it would look like this
NAMES (Field name)
John (forename)
Smith (surname) There will always be 2 records
I need to take both these records and split them into two variables - one for the forename and one for the surname - (I need to insert these values into SQL statement)
Have tried the following code 'firstname' contains both the first and second name.
Code:
View Replies
View Related
I'm reading records from a recordset and placing them in a table. One of these fields is a date value and I format it using the following:
Code:
<%=FormatDateTime(oRs.Fields.item("DateRecd"), vbShortDate)%>
If this field contains no data, how can I display it without getting an error?
View Replies
View Related
I am trying to soleve the following problem using an asp recordset (connects to sql)
A column in the recordset contains integers between 1 and 5. I am trying to find a way of concluding which integer is the most common, then the second most common, then the third. (In the event of a tie, the higher integer 'wins').
Hence if in the record set there were 5 1s, 4 2s, 7 3s, 1 4 and 5 5s the output would be Most popular = 7, send most popular = 1 and third most popular = 5. I am familiar with rhe recordset objects ie looping through the records etc .
View Replies
View Related
I have part of a keyword search function that is acting supernatural - I have a bubble-sort function that sorts the content of an array, then returns an array containing the item numbers of the original array, arranged in order according to their content. Code:
View Replies
View Related
how to create an array of checkboxes that were selected from a form on one page and pass them into hidden fields in a form on the next page? I have this massive project I've been working on and am having trouble with this.
View Replies
View Related
I have this dynamic array(shown below) that I need to match to values (1 - 10) that I am returning from the database via DSN connection object.
The values I need to match are on the same page (in their own table) but I am not sure how to match up the array indexes to these values. I want to be able to display the array result as part of or nested in another table. Code:
View Replies
View Related
if i have a vbscript function on a certain form and I assigned some values on an array variable on that function, is there a way for me to retrieve the values of that array on another asp page once i submitted the form?
View Replies
View Related
I wish to display an image from a folder based on the name held in a field in a database.
<%
If len(rssal("picture"))>0 then
Response.Write ("<img src=""/ProductImages/rssal("ProductCode").gif"">")
ELSE
Response.Write ("<img src=""images/sorry.gif"">")
END IF
%>
View Replies
View Related
Has anyone else found a memory leak using ADO streams to access binary data held in a database. I have searched through this forum and have not come across anyone else, so maybe it is just me.
The scenario is as follows:
Windows 2000 SP3
MDAC 2.7 SP1
IIS5
MySQL 3.23
MyODBC 2.50
If I query the database and do a response.binarywrite everything works fine and no memory leak. eg. response.binarywrite myrecordset("blobfield")
If I read the very same BLOB field into a ADOstream I then get a memory leak in DLLHOST.EXE of how big that binary field was. ie If the picture is 140k in size DLLHOST.EXE increases its memory size by 140k.
This keeps on happening until DLLHOST.EXE is something like 250 MBytes in size at which point it stops working. Quick restart of the IIS Web service and I get all my memory back.
The command I am using to get the data into the ADOstream is picturestream.write myrecordset("blobfield")
I have also tried putting the binary data into a variable first before inserting it into the stream:
set x=myrecordset("blobfield")
picturestream.write x
The stream is closed and set to nothing at the end of processing. Everything is cleanly shut down. Through testing I know the memory leak occurs once the data has been written into the stream. The stream is correctly created as type binary.
The stream problem I am encountering does not seem to be limited to ASP, I tried it using Visual Basic to create a COM component to do the same job and still got a memory leak.
So the questions are:
1. Has anyone come across this before or fixed it?
2. Is there another way of getting binary data out of MySQL, something like the opposite of LoadFile?
I have wasted so much time on this problem but cannot find, having searched Microsoft's knowledge base and the rest of the web, any reference to the problem.
View Replies
View Related
I've seen alot of boring forms where a vbscript window will popup if the user submits a bad word in the form. Does anyone know of a tutorial or how to make a bad word filter written in asp that basically goes through an array of bad words and if detected the output would be something like:
<%response.write("Profanity is not allowed.")%>
View Replies
View Related
I have an interesting situation that needs to be addressed ASAP.
I am running a standard SQL Query in ASP to retrieve some rows/columns from a table that's on a SQL Server 2000 database. I put the results of that query into a RecordSet, and then use the GetRows function to push the results that are in the recordset into an array variable. In the query that I am running, 39 columns and 2 rows are returned.
The GetRows function appears to be working - the array variable is being created with the proper dimensions. However, the values of the different "cells" of the array are not showing up correctly. The first and the last column values for each row are correct, yet everything else in between is blank, empty, NULL, or whatever.
In other words: ArrayVariable(0,0) shows up correctly, ArrayVariable(38,0) shows up correctly, but everything in between is null.
I did a test on the RecordSet and discovered that it was the culprit - it wasn't being filled in properly. This is strange, though, because the select query that I run in the ASP code to create the recordset returns perfect results when I run it on the SQL Server 2K database.
View Replies
View Related
I'm looking for an asp page to detect if there are any characters in my
contact form that shouldn't be there. For example, if there is a "<"
character, then this may mean there is html in my contact form, which
is not good. I want to build a string that has all the values of my
textboxes in my contact form. Its not working? Code:
View Replies
View Related
I have set up a database, myDB, in MS Access. one of my Table, myTable, has columns Col1, Col2, ..., Col10. Depending on some scenarios, I insert some values in some (but not all) of the columns. Now I want to delete those records that their col3 is null or nothing is set.
I used col3= '' and col3=NULL in the below statement
objRS.Open "SELECT * FROM myTable WHERE col3 = '' ", myDB, , , adCmdText
but none of them works.How to delete a record based on Null value filtering?
View Replies
View Related