Parse a string from a field and display in table

Discussion in 'ASP General' started by Dan Somdahl, Apr 19, 2007.

  1. Dan Somdahl

    Dan Somdahl Guest

    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?
    Dan Somdahl, Apr 19, 2007
    #1
    1. Advertising

  2. Dan Somdahl

    Guest

    On 19 Apr, 11:25, Dan Somdahl <> wrote:
    > 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?


    I hv taken 2 table city and city1
    city(city, jobname)
    city1(ct1,ct2,ct3,ct4,name)
    record in city('delhi;kolkata;madras;banglore')
    2nd record('puri;sitamadhi;goa;mumbai')

    now it is my code
    <%
    dim stor(4)
    sql = "select city, jobname from city"
    set rs = con.execute(sql)
    if not rs.eof then
    while not rs.eof
    response.write(rs(0))
    response.write("<br>")
    ct = split(rs(0),";")
    len1 = ubound(ct)
    for i = 0 to len1
    stor(i) = ct(i)
    next
    sql1 = "insert into city1(ct1, ct2, ct3, ct4, name)
    values('"&stor(0)&"','"&stor(1)&"','"&stor(2)&"','"&stor(3)&"','"&rs(1)&"')"
    con.execute(sql1)
    rs.movenext
    wend
    end if
    %>
    , Apr 21, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    19
    Views:
    1,099
    Daniel Vallstrom
    Mar 15, 2005
  2. Dan Somdahl
    Replies:
    1
    Views:
    94
    Bob Barrows [MVP]
    Apr 19, 2007
  3. Scott
    Replies:
    5
    Views:
    197
    Thomas 'PointedEars' Lahn
    May 5, 2005
  4. Sound
    Replies:
    2
    Views:
    424
    Randy Webb
    Sep 28, 2006
  5. jr
    Replies:
    3
    Views:
    403
Loading...

Share This Page