Recordset query

Will a query like this on recordset work

rs.open "select * from table where vd = 1, set update table vd1 = 1 where vd = 2 or vd = 3;"

or something is wrong.

thank

0


source to share


2 answers


It won't work - you will have to execute them as separate commands

Presumably you declared it rs

as a recordset, so you can use it to return results SELECT

.



I would use a SQL command to execute the second statement.

0


source


A recordset can only be defined with a single SELECT statement (although of course you can select multiple UNIONs if they have the same number of columns).

Any SQL action (INSERT, UPDATE, DELETE) cannot be performed with a recordset, but using the .Execute method.



If you're using ADO, .Execute can also be used for SELECT (it returns rows), but the Jet data interface layer, DAO, cannot - .Execute only works for action queries. This seems reasonable to me, but then ADO always seemed like a waste of time to me.

In addition, Jet (the default db engine used by Access) cannot execute multiple SQL statements at once, as many server-side db engines do. This isn't as much of a limitation as it might seem to those accustomed to batch SQL - it's just different.

0


source







All Articles