Checking For Duplication In An Array Or Delimited String
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 am trying to run a asp sql query containging many tables. the main table though is a simple ID based table contains all ids from the other tables. Code:
I'm trying to read a tab-delimited file into an array so I can pick out different fields for a report. I keep getting a "Type Mismatch" error that I don't understand.
Dim objFileSystem, objFile Set objFileSystem= CreateObject("Scripting.FileSystemObject")
Set objFile = objFileSystem.OpenTextFile(sDataFile,1) sReadLine = objFile.readline
Do While objFile.AtEndOfStream <> True Response.Write "<UL>" & Chr(10) 'Response.Write objFile.ReadLine & "<br>" sSplit = split(objFile.Readline,"Chr(9)") Response.write sSplit ' I want to see the contents and this line is giving me the error Response.Write "</UL>" & Chr(10) Loop objFile.Close
I need to read a tab delimted file into an array with ASP. Should be easy enough, I know it is in Perl and PHP. Can someone show me how that's done or post a link to an example.
This is what I'm trying to do in perl:
#!/usr/bin/perl -w
my $file = "myfile.txt"; open(FILE, $file); while(<FILE>){ my ($f1, $f2, $f3) = split(' ', $_); # or @array = split(' ', $_) print "F1:$f1 F2:$f2 F3:$f3 "; } close(FILE);
I have written an ASP script that collects information from a form. The info is stored in one variable name. When I request the info, it is returned as a comma delimited string. How can I manipulate this string so the data can be stored in a database? I appreciate your assistance.
I have a string that I want to check to be sure there are no single or double quotes in it. Using RegEx should be possible but I cannot figure out how the syntax should go. I am programming in ASP.NET with C# as the code behind. here is one I know works to be sure there are only numbers in the string, but i can not for the life of me figure out the right syntax for quotes
if i need display daya from vertain column in option, and their is some data are duplicate( means with same words ) how to separete it? so that the same data will only dispaly once .
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.
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.
can anyone put me on the right track.i have a comma delimited file and i need to search through this file and locate where acctsessionid does not have 2 matching records and display them on an asp page.
need to query a database and then get the results in a tab delimited file.currently am writing record by record in the file using the FSO,but just wanted to check can we directly get the results in the TAB delimited format and save to a file on the server.
I need to be able to read a tab delimited text file with an asp page so that I can stuff the fields into a sql table.I really don't know how you can do that, I checked the books I have and have been running around the internet trying to find the answer when I found this site.I cannot use a bulk insert statement because I don't have that level of access to the sql server. and I was assured that "BCP is indeed a command-line only utility and cannot be launched from ASP. You could parse the text file with ASP and generate INSERT statements that you then execute against the database. Routines for parsing tab-delimited files can be had by searching for them on google quite easily." by the system administrator
<% arrName = Split(Request("TextArea"),",") %> <% For i = LBound(arrName) To UBound(arrName) Response.Write "ID: " & arrName(i) & "<br>" Next %>
I'm using a TextArea box to submit the following... A123,1 B123,2 C123,3 Results are... ID: A123 ID: 1 B123 ID: 2 C123 ID: 3 I expected something like... A123 1 B123 2 C123 3 For the sake of understanding, why are the results like above?
In the end, I want to insert these values into a table. A123 into Field1 .... 1 into Field2 B123 into Field1 .... 2 into Field2 C123 into Field1 .... 3 into Field2
What's the easiest way to generate CSV or a comma delimited file from an ASP recordset? I've seen a few searching the internet and they appear to be overkill or out of date.
Whenever I import a comma delimited file the field lengths are always 255. I tried an import specification in my code but they were stll 255 in length. I imported about 156 fields and about 140 came in at 255. Not gonna work.
How can I populate the results of a recordset into a comma delimited?
The recordset is only returning a sequence of ID's (one column - one dimension). I was trying the getRows and getString method. If the result was only one record it was okay, but for more than one result I was getting an unhandled data type error.
I would just like to place the values from the recordset into a comma-delimited list and then pass that into a javascript function?
Due to using a combo of OLEDB/ADO/ASP and JavaScript I was having trouble reading in CSV data so I converted my client's web site to use tab-delimited instead. Better for me, but client is adamant that their site's recent timeout problems are since I converted to this tab format?? Code:
I've been asked to develop a semi-automated type situation where we have a database table (sql server) and periodically, there will be a comma delimited file from which we need to import the data, replacing the old.
I naurally know that we can use [truncate tablename] to kill the other data, but does anyone have any examples of importing a comma delimited file into SQL Server with ASP?
Is it possible to have a search page that queries a sql database and then writes the results to a comma-delimited text file instead of displaying the results.
I have no problem creating the search page and displaying the results I just don't know how to create the comma-delimited text file from the recordset results.
I have a sql server 2000 table with a comma delimited list of ids. there is a seperate lookup table with a desc for each id.
I need for this data to be retuned in the same order in which the data was entered into the database. right now it is returning ordered by the id from the lutable.
I want to use a simple CDONT mail script to allow the administrator of a site to send an email blast to their users. there are approx 1600 emails in the MS SQL db table. I would like to parse the entire email address column and get a variable that is all the email addresses separated by a comma so that the form picks it up as all the emails in the 'bcc' field as in the eg. below..I know there has to be an easier way but I want to get these guys up and running.