the arguments "theArray" works fine in my function.
If I build my array with a for next my function (guessing) sees my argument
as a string. I have printed
out both values and they are exactly the same in appearance.
does ASP have arrays, and if so, can I use an array, inside a loop, to do the following.
x=field name *the field is now comma separated values* while x != rs.EOF take each part of x , put into array. filter recordsetABC with current part of X. display filtered recordset on screen. next x
My syntax is horrible, so ignore that, this is just a theory exercise right now.
Each three digit number in the string represents a unique ID of a file in a database. Following each ID are six digits, all seperated by a "_" . Each file will ALWAYS have six subsequent integers, such as above ID "234" has "_0_8_22_2_0_3_" following it.
What I am trying to figure out is given a string of any length of this specific pattern, how to decarle a multi dimensional array that would hold each ID and its corresponding digits.
To clarify a little further, this is from a shopping cart for a photographer. Each "ID" represents an image, each of the six corresponding numbers for each ID represents a qty for an image print size, ie., 4 4x6's, 5 5x7s, 0 8x10s, 1 16x20, 23 20x30's, 48 wallets. Oh, and the image ID's are not necessarily always going to be 3 digits, they could be of any lenght integer...
I want to convert the binary data to string. I tried doing the same using following peace of code.
Function SimpleBinaryToString(Binary) Dim I, S For I = 1 To LenB(Binary) S = S & Chr(AscB(MidB(Binary, I, 1))) Next SimpleBinaryToString = S End Function
It works fine when the data is English. But when the binary data contains some Japanese characters the resultant string gets corrupted.
In an application I'm working the user has the opportunity to record the despatching of one or more items with serial numbers.
For each item they despatch, they have to chose the serial no that they want to despatch from a list of available ones. In many cases, these items will be of the same time, so the dropdown of available serial no's may be the same. Code:
I've never been able to get my head round arrays, and despite expensive googling I can't work out how to sort this problem:
I have a simple shopping cart that attaches a stock ID number and a quantity to a session variable. Each item selected is added to the session("cart") as "ID.Quantity" and divided by a comma. Thus the string is "12.7,3.45,8.9" etc.
Can anyone show me how to turn this into a two dimensional array, so I can get the relevant records for each ID from my database and match it to the number requested? Splitting the string by comma and then by full-stop has beaten me.
I'm using Msxml2.ServerXMLHTTP.3.0 to fetch a HTML page on a remote server. The fetched page is then parsed and the information of interest is extracted and send to the client browser.
However, the remote server does not specify any character coding in its headers. If using ResponseText property in ServerXMLHTTP, some international characters are not decoded correctly. This is due to ResponseText assuming UTF-8 coding if no character set is specified.
My solution is to use the ResponseBody property which returns the web page as an array of unsigned bytes. I then convert the data to a string using the ADODB.Stream method as described here: http://www.motobit.com/tips/detpg_binarytostring/
The string is then parsed and the required information is pulled out.
This solution works just fine but I wonder if there is some more efficient (without the need for a byte to string converion) way to solve the problem.
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'm developing an Asp.NET system to take a CSV file uploaded via the web, parse it, and insert the values into an SQL database. My sticking point comes when I try to split() the string returned by readline() on the file.
The following code snippet works for me: tokens = "one,two,three,four".Split(",") for each token in tokens response.write("<td>"+token+"</td>") next
However, if I take the next line in the CSV, read using StreamReader.ReadLine on the PostedFile.InputStream, I receive "Object reference not set to an instance of an object." which I have narrowed down to be my string holding the line. Further investigation reveals that no other string member functions work on my line (.ToCharArray, .ToString, etc).
I suspect that StreamReader.ReadLine is not correctly returning a string, even though Response.Write(line) displays what I would expect .....
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 form in which several elements are expected to be all digits. Some of those elements can be left empty, but if specified they must be all digits. I have this Sub to edit them: ....
I am pulling info from a sql server By default the query pulls back the inforamtion as text.Therefore when I go to calculate some figures its giving me a type mismatch error. Is there a function in can call to convert a text string to an integer string using
rstSearch.Fields("name").Value .To pull back the info in a for loop
Error Type: Microsoft VBScript runtime (0x800A000D) Type mismatch
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.