key value in VB .asp page includes {} characters

I am working on a page that creates a records set from our database that includes some key string values and am running into an issue on the back end.

Setup:

On a VB ASP page, we run the following query to populate a dropdown that allows a visitor to select a company that they work at (as part of an voting form that submits to a results table):

Set rScompany_cmd = Server.CreateObject ("ADODB.Command")
rScompany_cmd.ActiveConnection = MM_webaccess_STRING
rScompany_cmd.CommandText = "select org_name, org_cst_key from co_organization where org_ogt_code='Distributor' and org_delete_flag=0  and org_cst_key in (select cst_key from co_customer where cst_type='Organization' and cst_member_flag=1 and cst_delete_flag=0) order by org_name " 
rScompany_cmd.Prepared = true

Here is the snippet of page code that sets up the value and company name in the dropdown:

<select id="nom_company" name="nom_company" class="maintext">
              <option value=""></option>
              <%
While (NOT rScompany.EOF)
%>
              <option value='<%=(rScompany.Fields.Item("org_cst_key").Value)%>'><%=(rScompany.Fields.Item("org_name").Value)%></option>
              <%
  rScompany.MoveNext()
Wend
If (rScompany.CursorType > 0) Then
  rScompany.MoveFirst
Else
  rScompany.Requery
End If
%>

Here is the problem - when I look at the data in the database, the string appears normal, 36 characters long.  When I look at the page code upon rending through a browser, the same string appears, but encapsulated with {}.  Example:

A8D78D82-2051-4FF6-AADC-0012FBEA3058  shows up as {A8D78D82-2051-4FF6-AADC-0012FBEA3058}.  

This is causing issues later on when another user has to organize and utilize these values in reports and the {} characters are breaking things for them.

So the question is:  why does this happen?  and What can I do to prevent it from happening or shape the data so that the {} characters are removed prior to being submitted to the results table.

Many thanks in advance!

chipsterva69Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

matija_Commented:
Have you tried with Function to remove those characters?

<option value='<%=RemoveJunk(rScompany("org_cst_key"))%>'>

<%
Function RemoveJunk(strChar)
  strChar = Replace(strChar, "{", "")
  strChar = Replace(strChar, "}", "")
  RemoveJunk = strChar
End Function
%>
0
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
I have no idea why the data would be put into brackets if it wasnt showing that way in the database, but you could always just do a REPLACE on the string to get rid of them:

<select id="nom_company" name="nom_company" class="maintext">
              <option value=""></option>
              <%
While (NOT rScompany.EOF)
              orgKey = rScompany.Fields.Item("org_cst_key").Value)
              orgKey = Replace( Replace( orgKey, "{", "" ), "}", "" )
%>
              <option value='<%=orgKey%>'><%=orgKey%></option>
              <%
  rScompany.MoveNext()
Wend
If (rScompany.CursorType > 0) Then
  rScompany.MoveFirst
Else
  rScompany.Requery
End If
%>

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
chipsterva69Author Commented:
Perfect!  One tweak to what was submitted - made sure the content of the value was set to the company name <%=(rScompany.Fields.Item("org_name").Value)%>, as opposed to <%=orgKey%>.

other than that - slam dunk.  Thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.