CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 1999
    Location
    US NJ
    Posts
    113

    SQL Field Error...

    Here is a tip.

    Public Sub RepairModule()
    ' Leo Koach (1999)
    ' This module takes out the "'" for SQL searches.
    X = 0
    Do
    X = InStr(X + 1, inp, "'")
    If X = 0 Then Exit Do
    inp = Left(inp, X) & "'" & Right(inp, Len(inp) - X) ' inp = <text>
    X = X + 1
    Loop
    End Sub

    At least this is the way I do it.

    Antbody has better ideas?

    www.openplace.com


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

    Re: SQL Field Error...

    Use the VB6 Replace$ function and replace ' with '' that way the query will work.

    Crazy D @ Work :-)

  3. #3
    Join Date
    May 1999
    Posts
    3,332

    Re: SQL Field Error...

    if you are trying to replace single quotes with two single quotes:

    search = replace(search, "'", "''")



    requires VB 6


  4. #4
    Join Date
    May 1999
    Posts
    3,332

    Re: SQL Field Error...

    cool, same answer at the exact same time! :-)


  5. #5
    Join Date
    Nov 1999
    Location
    US NJ
    Posts
    113

    Re: SQL Field Error...

    I wrote lots of programs I even sold most of them, I considered myself a professional, but...
    The small things like that make me think. I know too little.
    I have long ways to go still.

    Thanks friends.

    Leo


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