Forum Moderators: open
Within a SQL tabel I have a text field filled as follows:
Name [Color]
Example
polo shirt [Ocean Blue]
I would like to split this field in 2 parts:
1 Name
2 Color
Or as in example
1. polo shirt
2. Ocean Blue
Can someonec give me any direction?
I think what you will need to do is pull the information out of the database then process it before displaying it on your page.
Something like pull info from db, split the relevant string into an array using the split() function and then display the information needed on the page
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open(Server.Mappath("mydb.mdb"))
set rs=Server.CreateObject("ADODB.recordset")
sql = "SELECT * FROM table ORDER BY ID DESC"
rs.Open sql, conn
do until rs.eof
myField = rs.fields("myField")
myField = Split(myField, "[")
myField(1) = Replace(myField(1),"]","")
response.write "1. " & myField(0) & "<br>"
response.write "2. " & myField(1) & "<br>"
rs.movenext
loop
rs.close
conn.close
I havent checked it but it should be ok...... i think...