Results 1 to 3 of 3

Thread: [RESOLVED]-INSERT SQL question...

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2001
    Location
    Buffalo, NY
    Posts
    297

    [RESOLVED]-INSERT SQL question...

    Maybe I'm a retard, but does anyone see anything wrong with this line of code?

    Code:
    strSQL = "INSERT INTO tblCompetitors " & _
       "( strName, strStreet, strCity, strState, strZip, strManager, strP_ID ) " & _
       "SELECT '" & strName & "' AS Name, " & _
       "'" & strStreet & "' AS Street, " & _
       "'" & strCity & "' AS City, " & _
       "'" & strState & "' AS State, " & _
       "'" & strZip & "' AS Zip, " & _
       "'" & strManager & "' AS Manager, " & _
       "'" & Session("StoreNumber") & "' AS P_ID;"
    Because when it runs, it inserts ALL six fields worth of data into strName in tblCompetitors.

    Thanks!

    --Ben
    Last edited by BenFinkel; Feb 26th, 2003 at 01:25 PM.

  2. #2
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945

    Re: INSERT SQL question...

    Code:
    strSQL = "INSERT INTO tblCompetitors " & _
       "( strName, strStreet, strCity, strState, strZip, strManager, strP_ID ) " & _
       "Values( '" & strName & "' AS Name, " & _
       "'" & strStreet & "' AS Street, " & _
       "'" & strCity & "' AS City, " & _
       "'" & strState & "' AS State, " & _
       "'" & strZip & "' AS Zip, " & _
       "'" & strManager & "' AS Manager, " & _
       "'" & Session("StoreNumber") & "' AS P_ID;)"

    Try that.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2001
    Location
    Buffalo, NY
    Posts
    297
    Hey, thanks for the tip.

    Actually, as it turns out I did a bunch of cut & pastes, and all of the data was being populated into the variable strName while the rest were blank. Stupid typo on my part.

    Wish I had a good way to step-through ASP code in Interdev. Anyone know a way?

    --Ben

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