Re: Is there a better way to prepare an Insert?
Posted in 1998
To avoid big problems in the case of adding new column to the table try this one: "INSERT INTO <tablename> (<col1>,<col2,<col3>) VALUES (?,?,?)" Daniel Wright schrieb in Nachricht ... >Unless I'm missing something, you have to include a question mark for >every field in the table >(e.g. "INSERT INTO <table_name> VALUES (?, ?, ?, ?, ?)" in order to put >the SQL statement into a string in order > to prepare it.). > >I would like to avoid this...the big reason for wanting to avoid this is >that, if we add (or drop one) a column to the table, the >program with this PREPARE will be broken. (The other, related reason, >is that it is a pain to have to make the number of >question marks equal to the number of fields.). > >Any help would be greatly appreciated. > >Thanks, >Dan > >If replying by e-mail, use "danwright AT bigfoot.com" (yes, you replace >the " AT ", with "@"...just an attempt to slow the spam.) >