Solved

How to parse a single quotes in a dataset.table.select(stringfilter) method

Posted on 2009-05-04
2
278 Views
Last Modified: 2012-05-06
Hi,

I am looking to parse a string that contains an apostrophe and I need to parse the single quote.

dataset.Addresses.Select("AddressLine1 = '" + St.John's +"'")
need to parse the single quote in St.John's

Any suggestion
0
Comment
Question by:busapps
2 Comments
 
LVL 33

Accepted Solution

by:
Todd Gerbert earned 500 total points
ID: 24297809
You mean you need to escape it?  

I *think* that's dependant on the underlying database, but assuming you're using MS SQL Server you should be able to use two consecutive single quotes - St. John''s

string criteria = "St. John's";
.Select(AddressLine1 = '" criteria.Replace("'", "''");
0
 
LVL 1

Author Closing Comment

by:busapps
ID: 31577670
That worked Thanks
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now