CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Guest

    Single Quote Problem.....HELP

    Hi all,
    I have this problem with single quotes in my program. I have a name ie. D'Souza and when i use an update statement to enter any data into my database i get an error due to the conflict in the update statement.
    eg : Sql = "Update employees set employeeFirstname=' "& text1.text &" ',etc..etc"
    So since i have a single quote in the sql, it conflicts with the single quote in the name D'Souza and gives me the error.
    I would be grateful if you guys out there could help me out with this, thanks alot in advance.
    Derek


  2. #2
    Join Date
    Apr 1999
    Location
    Netherlands
    Posts
    181

    Re: Single Quote Problem.....HELP

    Make the single quotes ' to 2 single quotes '' ... If you have VB6, you can easily use the Replace$ function:
    s = Replace$(s, "'", "''")
    This should work (at least it does for me)

    Crazy D @ Work :-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured