Re: Building SQL

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Jezebel (dwarves_at_heaven.com.kr)
Date: 12/19/04

  • Next message: Fat Cat: "RTBBox, strange behavior."
    Date: Sun, 19 Dec 2004 19:17:38 +1100
    
    

    Don't understand what you mean by 'resolve the references' -- are you asking
    how to pass data to and from your class?

    Separately, you need to do a lot more work with your code to make it
    reliable. Currently --

    1) You're not specifying the fields into which you want the data inserted.

    2) You are assuming that the fields are strings.

    3) You're not checking if the argument values are valid. Your code would
    fail if any of those fields were null or contained a quote character, or
    were zero-length and the field won't accept zero-length strings.

    4) Your code is vulnerable to SQL injection. Do a Google if you don't know
    what this means.

    5) Instead of rst!fields(0) you can simply use rst(0)

    "Mark" <Mark@discussions.microsoft.com> wrote in message
    news:2E1ACE30-3E73-4176-9505-BF434D59F194@microsoft.com...
    >
    > I want to build a class that builds SQL statements (given a recordset as
    an
    > argument). I thought it would build a string that would be sent back to
    the
    > user program which could then be resolved in the user program and executed
    > with each new record.
    >
    > So if the string sent back to the user program looks like:
    > strSQL = " "Insert Into " & strTable & " Values (" &
    > Chr$(34) & rst!fields(0) & Chr$(34) & ", " &
    > Chr$(34) & rst!fields(1) & Chr$(34) & ", " &
    > Chr$(34) & rst!fields(2) & Chr$(34) & ")" "
    >
    > Is there any way to resolve the references in the user program so it
    becomes
    > an executable SQL statement (given rst and strTable = "myTable")?
    >
    > strSQLTwo = Insert Into myTable Values ("xyz", "1a2b3c", "123")
    >
    > Thanks, Mark
    >


  • Next message: Fat Cat: "RTBBox, strange behavior."

    Relevant Pages

    • Re: Alternate file types for RUN ?
      ... resolved at link time and are fixed. ... The references to the RTL routine symbols/entry points are only partially ... as a shareable image name and an offset. ... doesn't need to resolve this). ...
      (comp.os.vms)
    • Re: WXP SP2 Woes
      ... Hotfix to resolve your error regarding the strings section being too long. ... Client Security Rtvscan ... > add these missing settings (they are fully described in the white paper ...
      (microsoft.public.windows.server.sbs)
    • Re: Code to Color ActiveRow Columns A Through C
      ... Most people have problems with offset/resize ... ... (Win XP Pro SP-1 XL2000-2003) ... > 2) Having to resolve the range reference. ... Resize is very fast compared> to resolving a string references. ...
      (microsoft.public.excel)
    • Re: MDAC 2.7 with Win XP SP2
      ... This is not an MDAC issue or a COM issue, ... resolve the references but when I recompiled the solution I received ... When I open the same project on my Win XP SP2 machine, ...
      (microsoft.public.data.ado)
    • Re: "cant find project or library" error has started appearing in VBA running on Word 2003
      ... In the VBA editor, ... Most likely one or more of the references are marked as 'MISSING:' and need to be resolved. ... into the immediate window all is OK ... but this does not resolve the issue ...
      (microsoft.public.word.vba.general)