how to update rows with _RecoderSet? 
Author Message
 how to update rows with _RecoderSet?

Hi,
As the Title. The following are my codes:
...
CString SQL="Select id from database";
pRS->Open((LPCTSTR)SQL,...);
...
while(!pRS->adoEOF)
{
    pRS->GetFields()->GetItem("id")->Value=(long)m_id;
    pRS->Update();  // a run-time error will arise here!
Quote:
}



Sat, 07 Feb 2004 17:09:52 GMT  
 how to update rows with _RecoderSet?
Kevin,
   what "locktype" have you set when you Open()(not shown here)?  The
default is "readonly"...
HTH
wardo


Quote:
> Hi,
> As the Title. The following are my codes:
> ...
> CString SQL="Select id from database";
> pRS->Open((LPCTSTR)SQL,...);
> ...
> while(!pRS->adoEOF)
> {
>     pRS->GetFields()->GetItem("id")->Value=(long)m_id;
>     pRS->Update();  // a run-time error will arise here!
> }



Sat, 07 Feb 2004 21:11:33 GMT  
 how to update rows with _RecoderSet?
some of my code:
  m_pRcrdSet->Open((const _variant_t)(LPCTSTR)strSQL,
     theApp.m_pConnection.GetInterfacePtr(),
     adOpenDynamic,
     adLockOptimistic,
     adCmdText);

Quote:
> Kevin,
>    what "locktype" have you set when you Open()(not shown here)?  The
> default is "readonly"...
> HTH
> wardo



> > Hi,
> > As the Title. The following are my codes:
> > ...
> > CString SQL="Select id from database";
> > pRS->Open((LPCTSTR)SQL,...);
> > ...
> > while(!pRS->adoEOF)
> > {
> >     pRS->GetFields()->GetItem("id")->Value=(long)m_id;
> >     pRS->Update();  // a run-time error will arise here!
> > }



Fri, 13 Feb 2004 14:17:09 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. single row updates effect multiple rows....

2. Q: Error message "Multiple rows updated"???

3. No rows were updated pb

4. Problem locking a row for updating

5. Insert, Update, Delete of rows using OLE DB ATL Consumer Templates

6. Low-level API calls, How to update a row

7. ODBC: "Multiple rows were updated" ERROR

8. number of rows updated

9. SQLOLEDB Provider Row Updates

10. Can't update row data with SQLSetPos

11. Updating bulk rows of data

12. OLE DB: Error update row

 

 
Powered by phpBB® Forum Software