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 create a dynamic multi-dimensional array, based on a count from a database. The count is correct, but when I try to Redim preserve my array, I get an error...
how to get and assign the first dimension of a two dimensional array to another array? For example, I have a recordset object (rsObj) and then I take that object and assign to array (via GetRows() method). I would like to take just the first dimension and assign to another array, but I get a "Subscript Out of Range" error.... any ideas?
what i want to do is have a (multi dimensional?) array, so that each second dimension represnts a row of radiobuttons. The trouble is i don't know what to name the arrays as. Obviously for each row the names for the different radio buttons will be the same, meaning you can only select one.
in php you could do it with a single array as you name each row of radio button differently:
1st row: name='array[0]' 2nd: name='array[1]'
in asp it doesn't look like you can do it this way, because to create a similar array you'd do something like 1st row: name='array' 2nd name='array'
then use split in the recipient script. This does not work however, because each radiobutton (on all rows) has the same name, and therefore when you click one all the rest on every row are unclicked..
I would like to know how many rows and columns are created in the following array. Is it 10 rows and 2 columns or is it 10 columns and 2 rows? Dim Array(9,1)
I have searched for some info about it but not found any consensus. Some sources claim that the first number symbolizes the rows and the second number the columns and other sources claim the opposite. I am confused.
What is it really like? How many rows and columns?
Assume that I need an array with 2 columns and 5 rows then how should it be declared (4,1) or (1,4)?
Which is the first dimension and which dimension it the second one? Horizontally (first/second) vs vertically (first/second)?
How are the various elements called, for example how is the element on the first row in the 5th column called. By using (0,4) or (4,0)?
Assume that I want to store first and last names in two separate columns in an array and then expand the array by using Redim/preserve. The dimension I want to expand is the one with the rows because I view the array as a table with two columns.
I know there are certain rules that apply when it comes to using Redim/preserve on multidimensional arrays. Only the last dimension can be changed etc. How could that be done in this case? I am mainly interested in the declaration (1,x) or (x,1), where 1 is the number of columns and x number of rows (that is increased).
I am trying to create a form where you may have more than one person at a meeting, but want to have them be related to the same meeting.
I have a mulitple select text area and if you select more than one, all the records are being added to the same row. so if I picked the following three people:
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 need to loop through a two-dimesnional array (x,y) until a value in x is empty or the end of the array is reached, whichever comes first. Example array:
In the example above, the loop should stop once it determines myArray(3,0) is empty. If myArray(3,0) was not empty, the loop would continue until the end of the array was reached. Anybody have a code example to do this?
how do I resize a two-dimensional array? The array I'm working with is "data(X)(Y)" where X is 0 or 1 and Y grows to a dynamic number.If "data(1)(highest element)" IsNull, then I need to strike it from the array. I believe this should be doable by simply resizing the second dimension down by one. Through researching I established the following set of code:
I = UBound(data(0)) - 1 ReDim Preserve data(2,I)
But it results in a "Subscript out of range" message on the latter line. Short of looping through and building a new array.
I'm working on developing (yet another) shopping cart for my work. I was wondering if anybody knows which approach leaves a smaller footprint in memory on a server: an ADODB Recordset which stores arrays one-dimensional arrays or a two-dimensional array?
We are currently hosing our web site on a shared machine at Verio. The cart I have to build needs separate carts because a customer's products can come from different locations. Each location will have a different cart. On the cart page itself, I would like to display each cart in a separate location.
Logically, it make the most sense (to me, anyway) to use an ADODB Recordset to manage each individual cart (array) than to write the code to manage the arrays. What are the disadvantages of using ADODB recordset instead of a two-dimensional array in this case?
Which approach would be easier to manage and manipulate? Are there any reasons why I shouldn't use a two-dimensional array? The nice thing about ADODB is that I will not need to program certain features and have access to FILTERS.
Any suggestions about how each approach would scale as site traffic increases? Will one approach bog down the server more than the other? I'm also open to suggestions about a possible, yet illusive, 3rd way.
I understand the logic behind a multi dimensional array (sort of). What I need to do is be able to capture the product information (that is in a product session) that a user has selected and email it to a specific address.
The email coding page is written in javascript. This page is already being used to also send the customer credit information. If anyone has some insight in this I would be very appreciative. Code:
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)?
I released to open source a while back but forgot to post in here a DLL that was used in some of our older developments. It's not really a live project, but may be of use to peeps in here given some of the recent queries:Quote:
DBSite: Written in Visual Basic this DLL helps solve issues for ASP web developers, e.g. handling uploads, safe parameter population for stored procedures (sql injection checks), SQL XML calls, file system browsing, etc.
Trying to join three tables and find the records which DON'T match OR have less than x number of matches.Not sure how to go about it.keep getting matching fields only.
I need to create in asp/access/javascript a questionnaire that shows a single question on each page of which there are five then after the last question create a new record in the access db and write the answers.
is there a simple way of updating all the value fields with one form? so i can have the page lay the four value's out in a list, the user could then edit them and hit update and this would update all the value fields. i can update single records no problem but have no idea where to start with this one.
I have written a asp application whihc uses a number of pages and each page connects to a sql database. Currently I have the connection script coded on each page however if i need to change the database I have to change every page. I have been told there is a way to have the connection on one page and each page to referance this one so I only need to change the one page
As part of the development of a shopping basket function, I've a two dimensional aray which I'm storing in the session variable. I want the array to be dynamic to store any amount of products which may added.
I am getting a problem when trying to write to the second row to the array, saying that the subscript is out of range... You can see an example of this at: http://www.foulkestudios.com/session.asp
I am getting what should be the first empty row by getting rows=UBound(myArray,2) I'm then trying to add into the next row by using rows + 1
I am b-testing a community site, with currently 1,000 or so membership, and low concurrency, say no more than 5 on-line at once.
The site is hosted on a shared server, which is sufferening from intermittent accute slowness, affecting all other hosted sites as well as mine.
The finger of suspicion is pointing at me and possible sloppy code. As this is the first site I have done of this nature, could someone recommend reading matter (knowledge bases etc), especially coding samples, in connection with data connections (opening and closing connections and objects) and record locking issues, which if improperly coded, could contribute to throughput bottlenecks due to inefficient use of resources so that I can check out my pages and correct any nasties..
I need to develop an application that will span 12 or so pages, and on the last page, it lets the user review the data and then insert it all. This is kind of like selling something on eBay, you give it information, click next, enter more info and then at the end you review and submit the item. I was thinking about sessions, but some of the fields are pretty big, like varchar(5000) so I didn't know if there was a way to handle these big fields.
I am in the process of developing several web sites that will accommodate up to 3 or 4 languages. The sites are not that complex, but will use an Access database for some data presentation/storage. Each page will have a series of flags for respective languages. Ideally, if someone enters on a "gateway" page for say Gallery, and they choose another language, I would like the same page to display but in a different language (there might be a page for each language, but if I can avoid that I'd rather). So here are my thoughts on how to approach this. Have a session var for language preference and set it in a Global.asa file. I would think it could be set dependant on the origin of the request, .de, .co.uk, .it, etc. Then, if the code is not too verbose, use Case statements in the code to display content based on language preference. One thing of a bit challenging for me is that if the "flags" are in an include file, how can I get them to when clicked go to a script, change the session variable and return to the page from which it was clicked. Am I on the right track with this approach.
I have a database full of info and I have display.asp which I want to display 10 items at a time so I have display.asp?page=1, display.asp?page=2, etc. How do I go about actually filtering the database to only produce 10 results per page? I was trying to use:
results.Move 10
and things like that, but I'm not sure of the best way around this.
I have a table in the db and one field in the db is an email field various records can have the same email address in. When an email address changes from x to y I want to be able to change an email address x in every record in the table to y, how would I do this?
I was wondering if anyone had any links to some resources / tutorials or could offer up some help with regards to my current project. The concept is pretty simple. Multiple user login - which are then presented with a page where they need to answer some questions (drop-down responses). These responses are then checked against the answers and the points are then added and the results list the different users in descending order. Help and suggestions with any part of this would be greatly appreciated! I know this will be linked to a database (open to suggestions about which to use) and then how to structure my tables.