Click to See Complete Forum and Search --> : a newbie problem


JamesMao
December 15th, 2003, 08:13 AM
I need to change values of my records, but primary key value is not changed.
table: Student_ID(primary key), Name, Address

I created a class
class Student : public CCommand<CAccessor<Student_Node> > {
HRESULT Open(CString s) {
//a lot of definitions
HRESULT hr=CCommand<CAccessor<Student_Node> >::Open(session, "SELECT * FROM Student where Student_ID='"+s+"'", &propset);
}
}


and I declared a instant:
Student s;
s.Open("0098766U11");
so everytime, only 1 record is read. "0098766U11" is student id, which is primary key and referenced by other tables.

I try to update information as follows:
strcpy(s.Name,"XXX");
strcpy(s.Address,"YYY");
s.SetData();
s.Update();

Tt seems that the above statement cannot work properly. I checked MSDN, and a posible explanation is:
"The setting operation might fail if one or more columns is not writable. Modify your cursor map to correct this."
I don't know whether it is the cause, but if it is, there is no further information about how to "modify my cursor...".

Please give me advice. Thanks in advance.