Converting String To Array
I need some advice in converting a line of string into array. For example; "001,002,003,004,005,..." into 001, 002, 003 and so on. How can I do this?
View RepliesI need some advice in converting a line of string into array. For example; "001,002,003,004,005,..." into 001, 002, 003 and so on. How can I do this?
View RepliesI'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.
i have this array that i use in php and was trying to figure out a way to convert it to asp: Code:
View Replies View RelatedI am passing a string into a page and them looking up info to display from a database based on whats passed in. The link is www.domain.com/page.asp?variable='12345678'
Once inside the page the following code is executed Code:
i am doing this asp programming with vbscript and came across to this problem. i need this answer asap coz i have to submit my assignment tomorrow. the thing is in the code below all the condition under the if statement works EXCEPT where i want to say that 'OrderValue' has to be between 100000 and 999999 inclusive.
it doesnt work i hv used to 'CInt' function to change 'OrderValue' Integer 'OrderValue' contains the text/string entered from the previous page that was entered in a text box called 'txtSearch'
is any way possible to convert a string, which is a string of a number, to an integer (using VBScript). If not, are there any other solutions to have a number that is a string, and add one to increase that number?
View Replies View RelatedI am trying to populate column values from an Oracle database into an HTML "Select" control. The column in the databases is defined as number. It is not working because I think I need to convert the value from the databases into a string variable first.
View Replies View RelatedIs there any function or some code to convert string to unicode directly or ( string to ascii and then ascii to uniccode ).
View Replies View Relatedi got some text fields im submitting by a form and i need to add the field to the current field in the table but the field is text in the table so when i do this
request.form("dkp1") + getraids.fields.item("dkp1").value
i have dkp1 = 10 from the form
and 20 in getraids field
and the above calculation it dosn add but puts them to getter as a string like 1020 and i need to calculate it to 30. my real question is there a way u can define the request.form(dkp1) to be converted from text to numberic ? and getraids of course or do i realy need to change the field type in the table ?
Am collecting numerical entries from text boxes and converting to numbers using:
F1 = Round(CDbl(Request.Form("amout1")),2)
F2 = Round(CDbl(Request.Form("amount2")),2)
F3 = Round(CDbl(Request.Form("total")),2)
F4 = F1 + F2
If F4 <> F3 Then
Session("ErrorMessage") = Session("ErrorMessage") & "- Your control amounts do not tie to the Total Deposit amount.<br>"
End if
etc.
Sometimes it works, but other times, although the numbers tie out, the calculated amounts are not coming up as equal. I've written the results (F3 & F4) to the screen and they equal, although the server doesn't think so.
Is this an issue with binary number conversion or something. Should I be using something other than CRnd (Delphi has something like C$ or CCurrency)??
I have the following stored procedure:
CREATE PROCEDURE [dbo].[GET_CategoryCurrentNewsList]
@Category VARCHAR
AS
BEGIN
SELECT dbo.News_Joined.NewsTitle, dbo.News_Joined.NewsID
FROM dbo.News_Joined
WHERE (dbo.News_Joined.StartDate <= GETDATE()) AND (dbo.News_Joined.EndDate >= GETDATE()) AND (dbo.News_Joined.CategoryID IN (@Category))
END
GO
dbo.news_Joined.CategoryID is an INT, and @Category is a string such as (1000, 1010, 1020). However, no results are returned. I figured I had to do something to do some string conversions from INT to VARCHAR or something, but I can't use CSTR. I do not know how many numbers will be passed to @Category, so making seperate variables isn't an option.
Any ideas???
I am having terrible time in converting a string to a datetime field in my asp page. I am keep on getting error on the following stateement. What would be the correct syntax on converting string to datetime for inserting into a sql table?? I did write the add_str out on the browser, everything looks correct...
Error message:
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting datetime from character string. Code:
I'm passing a unique identifier from page1 to page2 to page3 querried from MS SQL Server. When I pass the value, it puts the value in the curly brackets. (Page1 is for display and Page2 is for edit and Page3 is update edit)
When I go to Page3, it gives me an error saying "Syntax error converting from a character string to uniqueidentifier" {7171B9BD-4599-43D9-9521-3DA583A1BB1A} This is the value and the error page says "id=%7B7171B9BD-4599-43D9-9521-3DA583A1BB1A%7D" It seems tp put "%7B" and "%7D" for "{" and "}". Has anyone seen this?
I'm also passing numbers and text and they don't seem to have this problem, just the unique key.
if my month is represent by numbers. like 2, 4, etc
i recognize this as a string but then i want to store it as int
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the varchar value '2, 2, 2' to a column of data type tinyint.
/ords/asp/custorder_view.asp, line 41
u can see the varchar value to colum of data type tinyint
I'm such an idiot. I used to actually be good at this ASP stuff. Ah well.
I have a string, for instance:
40, 43, 1, 2, 3, 60, 64, 65, 66
Which I need to get into the DB as individual numbers... Any clue how to do this quickly and easily?
If I use a literal string:
theArray = Array("66.134.63.152", "66.134.63.152", "24.15.41.147")
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.
Any suggestions?
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.
Is it possible to use a string to index an array rather than a number? Eg
myArray(lets) = "hello"
myArray(uses) = "goodbye"
myAray(words) = "something"
Response.Write(myArray(hello)) gives 'hello' .
Ok, given a string such as this -
203_2_0_0_1_5_0_234_0_8_22_2_0_3_345_2_3_0_0_0_9
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...
Can i use string indexed arrays in ASP?
Such as in PHP: $arr['string_index']='ok'?
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 need to create a 2 dimensional array from a string with 2 kinds of delimiters
sample string: Code:
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 dump the entire recordset into an array:
If not rs.EOF Then
aEmp = rs.GetRows()
Contents of the array are in this order:
EmpID,EmpName,Indent,Sub_ID,Lft,Rgt,MgrID, LastName
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
Code:
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 am using two fields on a form to capture time someboby is working. The fields are hours and minutes. How can I when submitting to the db take both fields and convert them to a single field in the db as minutes?
View Replies View RelatedI'm looking for a control to us on our web site that will take our reports
that are generated in PDF and convert them to DOC format all on the server.
We are using win2k3 web servers if that helps.
I have developed an access database with VBA. Right now its on a network drive and is shared by 75 users. Works fine.
Now I would like to have this in the company intranet. Is it advisable to go with ASP? I recently installed IIS in my system. After that I have no idea how to convert my application to ? Is there a website or any walk through how to get my stuff's solved.
My application has 20 input screens, data add, save, update and also sends email based on certain rules. Is it possible to do all these stuffs?
I want to convert CSV file to XLS. Is there anyway this can be done in ASP without renaming the file to XLS.Also can there Macros to Sort data in it while generating XLS?
View Replies View RelatedWe are evaluating a clients request for converting their existing site using cgi and flat text files to ASP 3 and Access.
The site displays: their products that are broken down into sub categories, guest book, and a survey.
I am only "aware" that text files can be imported into Access but have never done it.
I have some PHP scripts that need to be converted to ASP3 so that they can run on a Micrsoft NT server using ADO. My knowledge of ASP is limitied so i was hoping you could answer a few questions..
1. Is ADO part of ASP.net or is this completely different?
2. Is ASP3 the same as ASP.net?
3. Is there any advice you can give me regarding converting from PHP to ASP3?