.NET, SQL, and apostrophes

  • Thread starter Thread starter Chris Huddle
  • Start date Start date
C

Chris Huddle

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
 
Chris Huddle said:
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.
 
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
 
Back
Top