By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,759 Members | 1,727 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,759 IT Pros & Developers. It's quick & easy.

Parse a string from field CORRECT EMAIL

P: n/a
Hi, I am new to ASP but have what should be a fairly simple task that I
can't figure out.
I need to parse a string from a single, semi-colon delimited, 60 character
field (el_text) in a recordset and display the results in a table on a
webpage (ASP)

I can retrieve the recordset from the database and display the field data
results in rows of a table but have the entire 60 character string in one
cell. I need to break that string apart and put each semi-colon delimited
value in it's own cell. Then move to the next record and do the same thing
in the next row of the table. - and so on

I'm using ASP, VB Script with DMSII Database and OLEDB

Does anyone have some code examples on how to break this field apart and
then arrange the data into an html table on a webpage?

Apr 19 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"Dan Somdahl" wrote:
I need to parse a string from a single, semi-colon delimited, 60
character field (el_text) in a recordset and display the results
in a table on a webpage (ASP)
JScript example:
for (; !RS.EOF; RS.MoveNext()) {
var a = RS.Fields("el_text").Value.split(";")
Response.Write("<tr><td>")
Response.Write(a.join("</td><td>"))
Response.Write("</td></td>")
}

Alternate JScript example:
for (; !RS.EOF; RS.MoveNext())
Response.Write("<tr><td>"+RS.Fields("el_text").Val ue.replace(/;/g,"</td><td>")+"</td></td>")

VBScript left as an exercise. I suggest you look at these functions:
http://msdn.microsoft.com/library/en...c7da8abe8c.asp
http://msdn.microsoft.com/library/en...8c39a939d4.asp
http://msdn.microsoft.com/library/en...657489dd34.asp

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.

Apr 20 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.