Results 1 to 3 of 3

Thread: SQL from VB app question...

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2008
    Location
    Texas
    Posts
    1,288

    SQL from VB app question...

    Ok I'm creating a sql query with a string variable and executing it in vb.

    The string would look something like:

    Insert Into Table (vara,varb,varc) Values ('vara','varb','varc')

    This works fine.

    But I have an instance where one of the values passed has a ''' character in it like so:

    Insert Into Table (vara,varb,varc) Values ('la'vara','varb','varc')

    Which messes everything up. I was thinking about using the controlchars but wouldn't the ending string be the same and still mess up?

    How can I get around this? Sorry if the question is silly, I've just never had this problem.

    Thanks,

    Justin
    You down with OOP? Yeah you know me!
    MCAD and MCMICKEYMOUSE (vb.net)

    ----

    If it even kinda helps... rate it : )

    Edit a Multi-page .tif file and save.

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: SQL from VB app question...

    From db faq/tutorial: Why should I use parameters?

    Answer: Your problem is exactly why.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2008
    Location
    Texas
    Posts
    1,288

    Re: SQL from VB app question...

    Sweet! I'll just change my existing DatabaseOps class to have the Base Execute functions use parameters instead of just a single string variable : ).

    Thanks for the link.
    You down with OOP? Yeah you know me!
    MCAD and MCMICKEYMOUSE (vb.net)

    ----

    If it even kinda helps... rate it : )

    Edit a Multi-page .tif file and save.

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