Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Trying to execute a simple command...

Trying to execute a simple command...

Scheduled Pinned Locked Moved Web Development
sysadminhelpquestion
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Robby
    wrote on last edited by
    #1

    I am attempting to create a variable for every field in a record set. When attempting to run this code, I get simply a "Syntax Error". Does anyone know why this won't work? Set RS = Server.CreateObject("ADODB.Recordset") RS.Open "SELECT * FROM " & tableName, MyConn For each Field in RS.Fields createVar = Field.Name & "=" & Field.Value Execute(createVar) Next Thanks

    R N I 3 Replies Last reply
    0
    • R Robby

      I am attempting to create a variable for every field in a record set. When attempting to run this code, I get simply a "Syntax Error". Does anyone know why this won't work? Set RS = Server.CreateObject("ADODB.Recordset") RS.Open "SELECT * FROM " & tableName, MyConn For each Field in RS.Fields createVar = Field.Name & "=" & Field.Value Execute(createVar) Next Thanks

      R Offline
      R Offline
      Roger Wright
      wrote on last edited by
      #2

      Execute is a method associated with a Server, Connection, or Command object in ASP, not a standalone function. It looks like you're trying to append field values to field names, then treat them as functions. What are you really trying to accomplish? "Another day done - All targets met; all systems fully operational; all customers satisfied; all staff keen and well motivated; all pigs fed and ready to fly" - Jennie A.

      1 Reply Last reply
      0
      • R Robby

        I am attempting to create a variable for every field in a record set. When attempting to run this code, I get simply a "Syntax Error". Does anyone know why this won't work? Set RS = Server.CreateObject("ADODB.Recordset") RS.Open "SELECT * FROM " & tableName, MyConn For each Field in RS.Fields createVar = Field.Name & "=" & Field.Value Execute(createVar) Next Thanks

        N Offline
        N Offline
        Nathan Ridley
        wrote on last edited by
        #3

        Isn't it Server.Execute? I could be wrong... NATHAN RIDLEY Web Application Developer email: nathan @ netlab.com.au [remove the spaces before and after the @ symbol]

        1 Reply Last reply
        0
        • R Robby

          I am attempting to create a variable for every field in a record set. When attempting to run this code, I get simply a "Syntax Error". Does anyone know why this won't work? Set RS = Server.CreateObject("ADODB.Recordset") RS.Open "SELECT * FROM " & tableName, MyConn For each Field in RS.Fields createVar = Field.Name & "=" & Field.Value Execute(createVar) Next Thanks

          I Offline
          I Offline
          Ian Darling
          wrote on last edited by
          #4

          This is why we have this thing called an "Associative Array" (Dictionary to Office/VB users, std::map to C++ users). So why not create a dictionary, and use that to store the values in, using a lookup on the field name? -- Ian Darling "The moral of the story is that with a contrived example, you can prove anything." - Joel Spolsky

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups