REDIM Preserve "Out Of Range"
REDIM Preserve reports an "out of range".
I first create an array, store it into a session var then, in other page, I load restore the session var into a local array but, after this, I can't REDIM Preserve.
REDIM Preserve reports an "out of range".
I first create an array, store it into a session var then, in other page, I load restore the session var into a local array but, after this, I can't REDIM Preserve.
I'm trying to build an array with the ID's of the users I have in a Mysql table called tbl_user.
Here is what I coded :
dim listeId(1)
i = 0
Set rs=Conn.Execute("SELECT ID from tbl_user ORDER BY Id;")
Do While Not rs.EOF
if i = 0 then
listeId(i)= rs("ID")
else
REDIM PRESERVE listeId(i+1)
listeId(i)= rs("ID")
end if
i = i + 1
rs.MoveNext
Loop
rs.close
But I get this error: (0x800A000A)
which is something like "fixed or temporary locked array"
Is it correct to think that after reducing the populated array's size from say, 10 to 5 with redim preserve myArray(i) an attempt to access an element above the fifth does not cause a compillation error "array out of script", but returns whatever heppened to
be written in that memory address (in particular it might return the correct values of those elements before re-dimentioning)?This seems to be the case in my code, yet I wanted to make sure that this isnot the result of some other side effect.
I am implementing a site where an admin user can log purchases of items into a DB.
Obviouslt, one purchase can consist of many items. I am therefore trying to implement a 'Cart' idea wherby the user adds the items to be purchased to the cart and then completes the purchase once all items have been added to the cart.
i aM IMPLEMENTING THE CART FUNCTIONALITY VIA AN asp ARRAY. nOW I CAN Do THIS NO PROBLEM, APART FROM THE FACT THAT, i declare an array of size 10, with 5 attributes to each element. i.e.
Dim purchaseCart(10,4)
The problem is, i want to be able to ensure that if the user decides to purchase more then 10 items, that the array can be ReDimensioned to suit i.e. increase size by one every time another element is added, after it has reached its maximum size!! Code:
How can I read back info from a database into an input field (in case it's to be edited) that will preserve the zeros to the right of the decimal?The zeros are being preserved in the access database when I have a look at it there. I have the field defined as type "Currency" to two decimal places.
I want to preserve those zeros to the right of the decimal point when I read the record into an input tag on a web page.I am trying to use "FormatCurrency(request.form(exp, 2))" and "FormatNumber(request.form(exp, 2))" but it doesn't help.
How an earth does this reDim of an array work ? I am looping through 1 array using a for loop and rediming an array within there. Code:
View Replies View RelatedI'm trying to build a piece of code that loops through the Request.Form collection, takes the "name" part of the name/value pair of each Item in the Request.Form collection, splits them into an array based on a common Form Field naming convention, and outputs the result (the full code will do much more - I'm just trying to build this in "baby steps").
Ex:
If my Form field names are:
t_FirstName
t_LastName
i_StateOfResidence
I wrote this code to loop through these, split them based on the underscore character ("_"), and output the results: Code:
I've got the following code which should write the contents of a textarea to a '.txt' file:
Code:
set objFileSystem = server.createobject("Scripting.FileSystemObject")
set objFilePlainText = objFileSystem.CreateTextFile(server.mappath("templates/my-text-file.txt"),true)
objFilePlainText.write(strTemplatePlainText)
If I response.write this data before inserting to the txt file, it preserves the line breaks, but when it writes to the txt file it seems to lose all of the line breaks.
Does anyone know how to get this to preserve the formatting of the text being inserted?
I have a .asp form page that submits to another .asp page that uses cdonts to send me an email and does a response.redirect back to the form page. I need to preserve (keep) a couple of text box values and a couple of dropdown box values.
At this point I have global.asa variables for the fields in question and they are all set to null. I can't figure out how to put the contents back in the fields, when it returns from the cdonts page. I assume that I must save all the field values in the session variables just prior to the submit to the cdonts page.
show me how to accomplich this for one text field called name and one dropdown box called PUDeliv?
I guess one should declare the array using empty brackets.
Dim MyArray()
Later I set MyArray to:
Redim MyArray(2,3)
The problem comes now. How should I use Redim again? I have heard that only one of the two dimensions can be enlarged or decreased. Is that correct? If so, which dimension would be ok to set to 5 in MyArray. Is ReDim MyArray (2,5) correct or should it be (5,2)?
If an ip address falls in between 29.0.0.0 to 29.255.255.255 then i would like something to happen. I m not too good with the sql math part but i figured it would be something like this
Code:
<% if Request.ServerVariables("REMOTE_ADDR") >= "29.0.0.0" or <= "29.255.255.255" then Response.write("hello") end if
Once i inserted "date()" in date field
This worked fine for 3days
but on the 4th day I got this error
The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
Again I changed the format of date to oracle DB format
and Ive solved the prob
I just want to know why I got that error
I have a database with a table that contains date fields "startdate" and "enddate". How do I build a code in asp to select the data contained between a date range entered
by the user?
I need to compare an IP address to a database that contains ranges for each byte in a potentially "valid" IP.
Columns in the msSQL db are IP1, IP2, IP3 and IP4.
The problem is that one entry in the database may have a range. If I were to query all four columns and concatenate the data, I may get something like this:
12.35.124.12-89
So if a user sends me 4 variables (1 for each byte in IPv4) over a form, how I would I begin to compare this data?
I'm trying to set up a random product feature on my site. Originally, I set up a hard-coded array of the ID numbers I wanted to randomize, but now I want to set it up so the random numbers are the ten most recent products. Code:
View Replies View RelatedMy SQL statement is returning either 0 or all members not just the members that are beyond todays date.Code:
strCountPaidForumMembers = "SELECT COUNT (members.membersSubExpires) AS totalPaidMembers FROM members WHERE (((members.membersSubExpires)>=" & date() & "));"
Can someone help me find out why i am getting this error message :
Microsoft VBScript runtime error '800a0009'
Subscript out of range: '[number: 47]' /Risk/Risk_Continued_test.asp, line 72
my code is :
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")
' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
Next
Can anyone tell me what this error means?
Microsoft VBScript runtime error '800a0009'
Subscript out of range: 'Request.QueryString(...)'
I have a db with dates. I have an sql select statement that is able to select records with a range of dates. The problem occurs when I choose a range of dates from 2 different months.
Code: .....
I'm querying to get an array of numbers. I need to find the "Middle %50" of that array of numbers. Is there a way to find the Inner Quartile Range using an ASP function? I cannot find any math functions that would do this.
Could I do it manually? Sort the values, split the array up, split it again to find the "Middle %50"?
I have this dropdown box and the options is TimeShift (6a-2pm, 2p-10p, 10p-6a ), im getting this data in a table (Acess DB) . My problem is how can i display (option selected) the actual shift based on the actual time. Code:
View Replies View RelatedI am looking to make a sql query with a date range of "last week". This would be 2 sundays ago to last saturday.
View Replies View RelatedI have a requirement where I need to make a report for each auto dealer how many hits they got on specified date range, so for each car detail page I increment the counter and total it while doing that I store the last hit date, this gives the total hits for the dealer BUT does not facilitate date range
How do I give the user a date range so that he can check how many hits the dealer got lets say for last week OR last couple of days?
I select from an Access table " where date >= '3/1/2004' and date <='3/31/2004' ", but no record. Can you tell me how to make this comparission?
View Replies View RelatedI have to put Date Range Query using start and end date form. I have tried but when i run the query puting start and end date value in form, no result shows the records and when i only put start or end value the result shows the records. Code:
View Replies View RelatedI'm using "POST" vs "GET" because the string is so long, but I'm wondering if the string is to long even for "POST". Code:
View Replies View Related?? anyone it's in the title
Code:
<%displayscreen= Replace(Screen,"Contract Status - ","")
IF displayscreen= "New" THEN
Strsql="update toplinedata set reschedule=1 where cnum=" & JobsToUpdate(x)
SQLConnect.execute(StrSql)
end if
%>
when a form is submitted which takes it to a process page, i have 2 seperate fields called hour and min to insert into a database field, basically what i want to do is run a check on the hour field to make sure it doesnt go higher then 23 if it does, return an error, also with the min field to not go above 59
View Replies View RelatedI'm getting this error:
Microsoft VBScript runtime error '800a0009'
Subscript out of range: 'True'
/Featured.asp, line 28
on this code:
I am currently having error with Subscript and whenver I use the upload form script, following error is printed.
Microsoft VBScript runtime error '800a0009'
Subscript out of range: '[number: 7]'
/admin_dates.asp, line 57
Following is my code where I think the problem lies -
Code:
How to code for a date range search? For example I want to search for applicants who applied in between dates of Aug 1st - Aug 4th, how would I code it ? I am using ASP to code and SQL Server 2000 for DB.
View Replies View RelatedI want to select release dates from a large table and have it so my script only displays release dates PAST the current date.My script looks something like this but it's obviously wrong.Code:
sql = "SELECT * FROM searchtable WHERE console = '"& console &"' and release > "& date() &" ORDER BY release ASC"
The field "release" is set as a varchar with values such as 9/10/2005
I am back with another question. I need to have the user input two dates for a date range--thats easy! But now I would like to pull all the files up in a directory that are within that date range. I don't know how to do a comparison on dates.
I already have a working script with a loop pulling up all the files in a directory based on one date entered and listing them ---now I want to make it pull up all the files within this date range---just need to know you can do a date comparison in asp.