CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Guest

    ! SQL help with Update! (I think)

    Here is my code, and I keep getting an error. I want to update an Access record that has more records than this. It reads them just fine when I change the SQL to a select statement.

    CDatabase m_dbEdit;
    CRecordset rsEdit;
    CString strConnect;
    strConnect ="ODBC;DSN=database;UID=;PW=;";
    m_dbEdit.Open("",FALSE,FALSE,strConnect,FALSE);
    CString strSQL;
    strSQL = _T("UPDATE table SET Variable='edited' WHERE ID=1");
    rsEdit.Open(CRecordset::snapshot, strSQL);
    rsEdit.Close( );
    m_dbEdit.Close( );


  2. #2
    Join Date
    Apr 1999
    Location
    Alabama, USA
    Posts
    261

    Re: ! SQL help with Update! (I think)

    You don't need to use the CRecordset to do an update. Just do something like:

    CString strSQL;
    strSQL = _T("UPDATE table SET Variable='edited' WHERE ID=1");

    myOpenDatabase.ExecuteSQL(strSQL);




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured