Trying to execute a simple command...
-
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 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
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.
-
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
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]
-
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
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