Click to See Complete Forum and Search --> : updating question


jim enright
March 22nd, 2007, 10:04 AM
using vc++2005 and ADO to access MSAccess tables.

using the following style (for a record with two fields: k1,k2 say) to update
fields sequentially:

variant.vName.SetString("k1");
variant.VValue.SetString("a");
RecordSetPtr->Update(variantvName,vValue);

variant.vName.SetString("k2");
variant.VValue.SetString("b");
RecordSetPtr->Update(variantvName,vValue);

would like to update all fields in a single operation - ie set all field values
first then a single update command.

look all over the place for doucmentation - much of it suggests
i can use lists of some sort in the update command eg:

RecordSetPtr->Update({k1,k2},{"a","b"});

but i can never get any attempts at this to compile nor have i found code esamples in the documentation.

how is this done ? pls use above example.

thanks in advance

ahoodin
March 22nd, 2007, 10:10 AM
I dont have your complete source, but maybe some includes?

#include <odbcinst.h>//odbc support

HTH,

jim enright
March 22nd, 2007, 02:59 PM
here is what i am doing:

vName.SetString("RateY");
s = "2007";
charstar = s;
vValue.SetString(charstar);
pRecordSet->Update(vName,vValue);

vName.SetString("RateM");
s = " 3";
charstar = s;
vValue.SetString(charstar);
pRecordSet->Update(vName,vValue);

vName.SetString("RateD");
s = "22";
charstar = s;
vValue.SetString(charstar);
pRecordSet->Update(vName,vValue);

....

here is something like i would like to do and the ms "documentation"
suggests is possible but supplies no examples:

pRecordSet->Update(
{"RateY","RateM","RateD",.....},
{"2007" ," 3" ,"22" ,.....}
);

intellisense indicates the function is
pRecordSet->Update(const _variant_t &Fields,const _variant_t &Values)
but any attempt at getting constructing lists fails to compile.