replace '

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm getting a data set returned from a web service and populating a datalist
on my page. There are times that a dataitem has ' in it (ex: car's, truck's,
etc), how can I remove the ' from the words?

instead of seeing car's i want to see cars, trucks, etc.
in VB.NET
 
Use the Replace function:

dim strTest as string = "g't"

strTest = Replace(strTest, "'", "")

msgbox strTest
 
Well, of course you would have to loop throught each row value in the dataset
and use the replace function on those values. I just wanted to make sure
that is pointed out.
 
Hi,

Instead of doing that for every row, SQL Server can do this for you.
Modify your select statement of the dataset from what is now eg.

Select col1 from table1 (col1 is the column with the data like "car's"
to
Select replace(col1,char(61),'') from table1
char(61) is the "'"
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top