Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 25th, 2010, 12:06 PM
Authorized User
 
Join Date: Apr 2005
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation Using Array.. comma separated

Hi All,
I am generating a text area against each recordset to capture the comments from users.
response.write("<textarea name='comments' id='comments' style='width:200px;height:50px;background-color:#8DB6CD;'>" & arcomments &"</textarea>")
when I am reading the data using array –
cust_number=split(Request.Form("cnumber"),",")
acc_sts=split(Request.Form("selACCStatus"),",")
acc_comments=split(Request.Form("comments"),",")
Dim i
dim lower
dim upper
lower=Lbound(cust_number)
upper=Ubound(cust_number)
For i = lower to upper
if trim(acc_sts(i))<>"" then
sql="update top_accounts_review set status='" & trim(acc_sts(i)) &"' , updated_date='" & now() &"', updated_by='" & trim(uname) &"',comments='" & trim(acc_comments(i)) &"' where fiscal_week='" & trim(sel_week) &"' and customer_number='" & trim(cust_number(i)) &"'"
con.execute(sql)
'response.write(sql)
end if

next

everything is working fine here, The only issue I am facing – when user enters the comma (,) in text area, script is considering that as the comment for another recordset as I am splitting the comments based on comma,
what should I change in my script so that, it should not split the data based on comma entered by users.
I hope, I am able to explain the situation.
 
Old June 27th, 2011, 11:57 AM
Friend of Wrox
 
Join Date: Dec 2006
Posts: 104
Thanks: 9
Thanked 1 Time in 1 Post
Default

I am fairly sure adding double speech marks should sort it eg
Code:
"'" & trim(acc_sts(i)) &"'"
 
Old June 27th, 2011, 06:54 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

This is a commer not a single quote right? If so I do not believe adding a double quote is going to help you...

Im not 100% accross exactley what you are trying to achieve but looking at your code I feel the method/design of what you are doing could be better.........anyhow......If you are capturing freet text from a user you need to allow them to punctuate, therefore you have to allow them to use commers (and all other commonly used characters). Based on this IMO you simply need to split the array on a different character.

Hope that helps
__________________
Wind is your friend
Matt





Similar Threads
Thread Thread Starter Forum Replies Last Post
Comma Separated values aldwinenriquez SQL Server 2005 3 June 1st, 2007 08:52 PM
comma separated list MunishBhatia SQL Server 2000 11 March 21st, 2007 03:56 PM
Comma Separated Column Value thru T-SQL subhendude SQL Server 2000 2 December 12th, 2006 01:42 PM
comma separated list of attributes rjonk XSLT 3 September 27th, 2006 11:52 AM
Select from Comma Separated Values sasidhar79 SQL Server 2000 2 March 28th, 2005 06:58 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.