473,386 Members | 1,842 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

breaking a string

I usesd this to display info on a page:
<% While not rstMain.eof %>
<tr>
<td><font size="-1"><%= rstMain("Datum") %></font></td>
<!-- <td><font size="-1"><b>Client no</b></font></td> -->
<td><font size="-1"><%= rstMain("Act") %></font></td>
<td><font size="-1"><%= rstMain("Item") %></font></td>
<td><font size="-1"><input type="checkbox" name="Inv" id="Inv"
value="<%= rstMain("TR_ID") %>"></font></td>
</tr>
<% rstMain.movenext
Wend%>

on the next page i want the data from the checkbox.it comes as a
string,numerics concatanated with a ","

i want to query according to this checkbox n tried this code:

For i=1 to (len(request.form("Inv")))
If left(request.form("Inv"),i) = "," Then
count = count + 1
End If
Next

'For i=1 to count do
'var1=instr(request.form("Inv"),",")

'sql="SELECT * From V_Transaksie Where ID=" &
left(request.form("Inv"),var1-1)
'set rstMain = CreateObject("ADODB.Recordset")
'rstMain.Open sql, "Provider=SQLOLEDB.1;Persist Security
Info=False;User ID=sa;password=admin@sql;Initial Catalog=GIS;Data
Source=172.16.4.180",1,4
All above ASP.Please help

May 4 '06 #1
6 1357

amatuer wrote:
I usesd this to display info on a page:
<% While not rstMain.eof %>
<tr>
<td><font size="-1"><%= rstMain("Datum") %></font></td>
<!-- <td><font size="-1"><b>Client no</b></font></td> -->
<td><font size="-1"><%= rstMain("Act") %></font></td>
<td><font size="-1"><%= rstMain("Item") %></font></td>
<td><font size="-1"><input type="checkbox" name="Inv" id="Inv"
value="<%= rstMain("TR_ID") %>"></font></td>
</tr>
<% rstMain.movenext
Wend%>

on the next page i want the data from the checkbox.it comes as a
string,numerics concatanated with a ","

i want to query according to this checkbox n tried this code:

For i=1 to (len(request.form("Inv")))
If left(request.form("Inv"),i) = "," Then
count = count + 1
End If
Next

'For i=1 to count do
'var1=instr(request.form("Inv"),",")

'sql="SELECT * From V_Transaksie Where ID=" &
left(request.form("Inv"),var1-1)
'set rstMain = CreateObject("ADODB.Recordset")
'rstMain.Open sql, "Provider=SQLOLEDB.1;Persist Security
Info=False;User ID=sa;password=admin@sql;Initial Catalog=GIS;Data
Source=172.16.4.180",1,4
All above ASP.Please help


You need to use the split() function:

checkboxes = split(Request.Form("Inv"),",")

This returns a one-dimensional array called checkboxes, with the first
index being zero. So to iterate through it:

For i = 0 to Ubound(checkboxes)
...do some stuff with the current checkbox - which is checkboxes(i)
Next

--
Mike Brind

May 4 '06 #2
Thanx i gt the var to split the numerics
bt nw i need to use these numerics in a query:

eg:
sql="SELECT * From V_Transaksie Where ID=" & 22 & "Or ID=" & 23
I need a way to find out hw many commas in the original var and hw many
"or" statements to add

May 4 '06 #3

amatuer wrote:
Thanx i gt the var to split the numerics
bt nw i need to use these numerics in a query:

eg:
sql="SELECT * From V_Transaksie Where ID=" & 22 & "Or ID=" & 23
I need a way to find out hw many commas in the original var and hw many
"or" statements to add


No you don't. Use the SQL IN clause.

sql="SELECT * From V_Transaksie WHERE ID IN(" & Request.Form("Inv") &
")"

--
Mike Brind

May 4 '06 #4
thanx Mike, i displayed the query and it looks like it'l work

May 4 '06 #5

amatuer wrote:
thanx Mike, i displayed the query and it looks like it'l work


No problem. By the way, if you ever did need to know how many values
there are in the array created by split(), Ubound(array) +1 will tell
you.

--
Mike Brind

May 4 '06 #6

"Mike Brind" <pa*******@hotmail.com> wrote in message
news:11*********************@g10g2000cwb.googlegro ups.com...

amatuer wrote:
Thanx i gt the var to split the numerics
bt nw i need to use these numerics in a query:

eg:
sql="SELECT * From V_Transaksie Where ID=" & 22 & "Or ID=" & 23
I need a way to find out hw many commas in the original var and hw many
"or" statements to add


No you don't. Use the SQL IN clause.

sql="SELECT * From V_Transaksie WHERE ID IN(" & Request.Form("Inv") &
")"

--
Mike Brind


Request.Form("Inv") needs to be vetted to ensure it doesn't contain
malicious SQL.

http://www.tech-faq.com/sql-injection-attack.shtml

Anthony
May 4 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: MarionEll | last post by:
--------------------------------------------------------- ************* Call for Participation ************** ************ Late Breaking News ************* *********** Extreme...
0
by: Amy | last post by:
I am looking for an rss feed that contains really important breaking news like "A large Tsunami just hit Asia" or "Terrorists attack the World Trade Center", but is empty if there really isn't...
27
by: The Bicycling Guitarist | last post by:
Hi. I found the following when trying to learn if there is such a thing as a non-breaking hyphen. Apparently Unicode has a ‑ but that is not well-supported, especially in older browsers. Somebody...
22
by: stevenkobes | last post by:
If a word has a hyphen in it, IE will permit a line break at the hyphen, but Firefox/Mozilla won't. Apparently the Firefox behavior is standards-compliant, but it is not what I want. Is there a...
4
by: John Wood | last post by:
I saw that Microsoft have released a list of breaking changes in .Net here: http://msdn.microsoft.com/netframework/programming/breakingchanges/runtime/default.aspx While this is useful, it seems...
150
by: tony | last post by:
If you have any PHP scripts which will not work in the current releases due to breaks in backwards compatibility then take a look at http://www.tonymarston.net/php-mysql/bc-is-everything.html and...
49
by: elmar | last post by:
Hi Clers, If I look at my ~200000 lines of C code programmed over the past 15 years, there is one annoying thing in this smart language, which somehow reduces the 'beauty' of the source code...
2
by: Ben | last post by:
I have this data I want to send over the network to the server. It is working fine except I don't know how to break up the buffer on the receiving side. On the client I am sending...
2
by: gitimaya | last post by:
hi, can anyone please help me in breaking up a string in array of strings. The delimeter is a character declared as '\001'. lets say i have a string as char d='\001' xxx'd'yyy'd'aaa i...
13
by: Andrew | last post by:
Hi I was wondering if there is anyway with XML RPC to send a string of text from the server to the client with out calling return thus breaking my loop for example def somefunc(): for...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.