p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

asp_forms thread: Split Function with Loops


Message #1 by "sahil Rahul421@u... on 10 Jan 2001 18:56:31 -0000
Hi,







I have a string which has the following data.







StrData=[Type_Basic] = "buyout" And [m Value] > 100 And [country] <> "united kingdom" 







I need to split the above string in the following manner using loops because i have to do this dynamically.







[Type_Basic] = "buyout"



And [m Value] > 100



And [country] <> "united kingdom"







As I am working with server side I am looking for the solution in VBScript.







Should you need further information please feel to contact me.







please help me...







Thanks & Best Regards,



Sahil











_____________________________________________________________



Signup for your FREE email account at http://www.lovemail.com

Message #2 by "Michael Fanara" <michael.fanara@y...> on Thu, 11 Jan 2001 08:20:51 -0500
Sahil,



Here's some code I use to rip through form elements and put them into

seperate arrays.



***********************************************************

Dim frmElements

For Each frmElement In Request.Form

Select Case frmElement



	Case "txtcontact"

		tcontact = Request.form(frmElement)

		'Response.Write "tcontact is " & tcontact & "<br>"

	Case "txtcemail"

		cemail = Request.form(frmElement)

		'Response.Write "cemail is " & cemail & "<br>"

	Case "oldcontact"

		ocontact = Request.form(frmElement)

		'Response.Write "ocontact is " & ocontact& "<br>"

	Case "oldcemail"

		oemail = Request.form(frmElement)

		'Response.Write "oemail is " & oemail & "<br>"

end select

next



aryocontact = split(ocontact,",")

aryboemail = split(oemail,",")

arytcontact = split(tcontact,",")

arycemail = split(cemail,",")







for p=0 to ubound(arytcontact)

on Error Resume Next

	ocontact = trim(aryocontact(p))

	oemail = trim(aryoemail(p))

	contact = trim(arytcontact(p))

	cemail = trim(arycemail(p))

on error goto 0



uQry = "update buildingcontactstmp set Contact = '" & contact & "' ,

Cemailaddr = '" & cemail & "' "& _ "where facid = '" &

Request.Form("buildid") & "' and Contact = '" & ocontact & "'"





'Response.Write " the update query is <br>" & uqry





objComm.CommandText = uQry

objComm.Execute



next

***********************************************************



Essentially what I'm doing here is taking multiple records from a form,

splitting the value pairs, and then taking each individual record and

inserting it into the DB.



Hope this helps





Michael Fanara

Network Administrator/Webmaster

Office of Facilities

Yale University

xxx-xxx-xxxx  (w)

xxx-xxx-xxxx  (f)

xxx-xxx-xxxx  (c)







-----Original Message-----

From: sahil Rahul421@u... [mailto:rahul555@l...]

Sent: Wednesday, January 10, 2001 1:57 PM

To: ASP Forms

Subject: [asp_forms] Split Function with Loops





Hi,







I have a string which has the following data.







StrData=[Type_Basic] = "buyout" And [m Value] > 100 And [country] <>

"united kingdom"







I need to split the above string in the following manner using loops because

i have to do this dynamically.







[Type_Basic] = "buyout"



And [m Value] > 100



And [country] <> "united kingdom"







As I am working with server side I am looking for the solution in VBScript.







Should you need further information please feel to contact me.







please help me...







Thanks & Best Regards,



Sahil




  Return to Index