From: Barry Sperling Date: 2005-02-10T02:19:52+09:00 Subject: DBI INSERT with variables Hello, I am using the Ruby DBI Module with Access on a Win 2K machine. I haven't found a way to use a variable field name with the INSERT statement. The "?" can be used for a placeholder in the VALUES according to the manual written by Paul DuBois, and that works, but I can't find a way to make it work with the field names. I have tried the following inside of a loop with "indx" as the loop variable: name = $Names.index(indx) # THIS IS A HASH rows = dbh_out.do( "INSERT INTO Tile (?) VALUES (?)",name,$Sum_By_Line[indx]) and also: sth = dbh_out.prepare("INSERT INTO Tile (?) VALUES (?)") followed by the loop with: sth.execute( name, $Sum_By_Line[indx] ) but they give an error which sounds like it won't allow the "?" as a field name place holder: The INSERT INTO statement contains the following unknown field name: 'Pa_RaM000'. Make sure you have typed the name correctly, and try the operation again. (DBI::DatabaseError) from e:/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:777:in `execute' Is it possible to have a variable place holder for fields or do you have to list each field explicitly? Thanks, Barry