473,403 Members | 2,323 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

.NET, SQL, and apostrophes

Normally, if you have a value in a SQL statement that contains an
apostrophe, you replace the ' with a ''. But how do you handle it in VB.NET
if you are using a DataAdapter? The SQL statements are created on the fly
by the commandbuilder and there's no way to replace the apostrophe. Surely
Microsoft has a way around this. Thanks! - Chris
Nov 20 '05 #1
2 2489
"Chris Huddle" <ch*****@timeplus.com> wrote in message
news:Oh****************@TK2MSFTNGP12.phx.gbl...
Normally, if you have a value in a SQL statement that contains an
apostrophe, you replace the ' with a ''. But how do you handle it in VB.NET if you are using a DataAdapter? The SQL statements are created on the fly
by the commandbuilder and there's no way to replace the apostrophe. Surely Microsoft has a way around this. Thanks! - Chris


Not sure what you mean, I don't have this problem. BTW: this is not an
ADO.NET group, you may want to try a more specific ng.

Nov 20 '05 #2
> Normally, if you have a value in a SQL statement that contains an
apostrophe, you replace the ' with a ''. But how do you handle it in VB.NET if you are using a DataAdapter? The SQL statements are created on the fly
by the commandbuilder and there's no way to replace the apostrophe. Surely Microsoft has a way around this. Thanks! - Chris


Here's how you get to the SQL that the Wizard generates:

After the wizard builds the DataAdapter for you, selec the DataAdapter in
the component tray of the designer. On the DataAdapter's property sheet,
there are four properties that represent the four commands that the
DataAdapter wraps. Expand the property for whatever command you're
interested in tweaking, and you can edit the CommandText property directly.

--
Peace & happy computing,

Mike Labosh, MCSD MCT
Owner, vbSensei.Com
"Escriba coda ergo sum." -- vbSensei
Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: middletree | last post by:
I put in some code to keep apostrophes from being a problem. However, on the display page, they have double quotes. What am I doing wrong? Here is the code on the page which captures the data...
8
by: Joe Van Meer | last post by:
Hi all, Been a while since I've done any asp coding, but happy to be getting back into it. My question is what is the best way (now) to handle apostrophes coming in from forms and going into...
4
by: Lord Merlin | last post by:
When I insert info into a DB from a form, it cuts the string off at the first apostrophe ("). How would I make it insert the data as-is, with the apostrophes? Here is the code used to insert the...
1
by: kalbee | last post by:
When we insert text into field in a table, SQL SERVER apparently replaces apostrophes with question marks -- is there a way to not have this occur? We don't have this happen with the mySQL...
2
by: Poster | last post by:
After creating an IN clause from a bunch of character strings created by a Word macro, Query Analyzer complains about a syntax error. The macro takes a column full of character strings and wraps...
3
by: James Foreman | last post by:
I've got a set of emails in a table, where sometimes they've failed to input the @ properly. Eg james.foreman'abcmail.co.uk How do I write a replace to deal with that? Also, I've got a set...
3
by: Richard Hollenbeck | last post by:
I have an email field and a command button to send email. The problem is that when the email program opens up there are apostrophes around the email address that I have to manually remove before...
5
by: james.igoe | last post by:
History: Took over development of Access project after half of app was developed. Continued the second half using same coding style as first developer, but improved upon code and flow, etc. ...
4
by: Nathan | last post by:
Hi, I'm doing a database app using MS Access and OleDb adapters, and I'm having trouble with getting strings containing apostrophes in and out of the database. I read through a thread below...
4
by: Lucanos | last post by:
Hey Guys, Probably a simple question, but one I am struggling with all the same. I know that in PHP you wrap a text string in apostrophes or quotations - (examples $variable = 'this string' OR...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.