Click to See Complete Forum and Search --> : An easy one, I think...


dirt29
06-16-2006, 12:26 PM
I think this is pretty simple..

I'm pulling entries from a DB to a DD List. The items that are returned have are named like such:

Microsoft 2000
Microsoft XP
etc, etc..

What I want to do is take the "Microsoft" off of the front..

I started to write something like this:

<%
po = rs("Name")

if left(po, 9)="Microsoft" then
replace(po, "Microsoft", "")
end if
%>


But when I pass back po, it's blank...As stated many times my VBscript is weak, but I feel like I'm pretty close. Any help?

dthurman1432
06-16-2006, 12:51 PM
You can try something like this:

<%
Dim po
po = rs("Name")

If po.value="Microsoft 2000" then
response.write "2000"
end If
If po.value="Microsoft XP" then
response.write "XP"
end If
%>

lmf232s
06-16-2006, 01:16 PM
<%
po = rs("Name")

if left(po, 9)="Microsoft" then
po = replace(po, "Microsoft", "")
end if
%>

dirt29
06-16-2006, 01:17 PM
Yeah, that might work, but I'd like it to be dynamic as I'm pulling entries from a DB.

lmf232s
06-16-2006, 04:34 PM
will the code i posted not work for what you need?
I was trying to help you out w/ the problem of PO being blank. I just assumed it was
because you were not setting PO = to the new string that had Microsoft stripped out.

More dynamic how?