replace '

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
 
J

Jeff Dillon

Use the Replace function:

dim strTest as string = "g't"

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

msgbox strTest
 
G

Guest

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.
 
A

Amar

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

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top