We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Inserting ' into table from vb to access. (Urgent)

tomerps1
tomerps1 asked
on
Medium Priority
368 Views
Last Modified: 2010-04-17
Hi,
i am trying to insert a ' from a visual basci query into a table in access but getting systax error becase while building query v use ' as text container like in follwoing line.
plz help me out.


insert into tblStudent values( 1, 'Sachin's wife'); //error

insert into tblStudent values( 1, 'Sachin s wife'); //no error



is there any way to solve this problem easy & reliable.
plz help with some gud example of quotation
must be simple if u  have more than one solutions plz welcome
thankx
Comment
Watch Question

insert into tblStudent values( 1, 'Sachin''s wife');
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
its doing same as venkateshwarr wrote, anyway ..
Unless I'm mistaken, that should be:

insert into tblStudent values( 1, 'Sachin\'s wife');
sorry ,
it should be
 insert into tblStudent values(1,'fixit(Sachin's wife)');
Mayank SPrincipal Technologist
CERTIFIED EXPERT

Commented:
>> insert into tblStudent values(1,'fixit(Sachin's wife)');

Guess it'll definitely not work. You're not calling the fixit () function. You're putting it as a constant 'fixit(...). Might give an error after Sachin'....

Perhaps what you can try is either what crazycomputers sugessted or if that doesn't work, use another dummy character instead of ' and while reading from the database, check if its that character and display ' in its place.
i meant

insert into tblStudent values(1,'" & fixit(Sachin's wife) & "');
The \ is standard for escaping special characters in SQL expressions, but we all know how M$ violates standards.  '' might work, but I'd put my money on \'

Author

Commented:
Thankx Nitesh Parmar
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.