如下几行代码,
m_piAdoRecordBinding->BindToRecordset(&m_rsLineBase)
m_rsLineBase.m_sLoadFlag = 3;
m_piAdoRecordBinding->Update(&m_rsLineBase);
在执行Update语句后,数据库中的数据没有被更新。相应字段仍为旧值。
请教各位,怎样用ADO邦定的数据更新数据库。

解决方案 »

  1.   

    检查下面强调的部分..
    Binding Entry Macros
    Binding entry macros define the association of a Recordset field and a variable. A beginning and ending macro delimits the set of binding entries.Families of macros are provided for fixed-length data, such as adDate or adBoolean; numeric data, such as adTinyInt, adInteger, or adDouble; and variable-length data, such as adChar, adVarChar or adVarBinary. All numeric types, except for adVarNumeric, are also fixed-length types. Each family has differing sets of parameters so that you can exclude binding information that is of no interest.See the OLE DB Programmer's Reference, Appendix A: Data Types for additional information.Begin Binding EntriesBEGIN_ADO_BINDING(Class)Fixed-Length DataADO_FIXED_LENGTH_ENTRY(Ordinal, DataType, Buffer, Status, Modify)
    ADO_FIXED_LENGTH_ENTRY2(Ordinal, DataType, Buffer, Modify)Numeric DataADO_NUMERIC_ENTRY(Ordinal, DataType, Buffer, Precision, Scale, Status,
                                       Modify)
    ADO_NUMERIC_ENTRY2(Ordinal, DataType, Buffer, Precision, Scale, Modify)Variable-Length DataADO_VARIABLE_LENGTH_ENTRY(Ordinal, DataType, Buffer, Size, Status,
                                                           Length, Modify)
    ADO_VARIABLE_LENGTH_ENTRY2(Ordinal, DataType, Buffer, Size, Status,
                                                           Modify)
    ADO_VARIABLE_LENGTH_ENTRY3(Ordinal, DataType, Buffer, Size, Length, 
                                                           Modify)
    ADO_VARIABLE_LENGTH_ENTRY4(Ordinal, DataType, Buffer, Size, Modify)End Binding EntriesEND_ADO_BINDING()
    Parameter Description 
    Class Class in which the binding entries and C/C++ variables are defined.  
    Ordinal Ordinal number, counting from one, of the Recordset field corresponding to your C/C++ variable. 
    DataType Equivalent ADO data type of the C/C++ variable (see DataTypeEnum for a list of valid data types). The value of the Recordset field will be converted to this data type if necessary. 
    Buffer Name of the C/C++ variable where the Recordset field will be stored. 
    Size Maximum size in bytes of Buffer. If Buffer will contain a variable-length string, allow room for a terminating zero. 
    Status Name of a variable that will indicate whether the contents of Buffer are valid, and whether the conversion of the field to DataType was successful. 
    The two most important values for this variable are adFldOK, which means the conversion was successful; and adFldNull, which means the value of the field was null, not merely empty.Possible values for Status are listed in the next table, "Status Values."
    /$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$/ 
    Modify Boolean flag; if TRUE, indicates ADO is allowed to update the corresponding Recordset field with the value contained in Buffer. 
    Set the Boolean modify parameter to TRUE to enable ADO to update the bound field, and FALSE if you want to examine the field but not change it.
    /$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$/
    Precision Number of digits that can be represented in a numeric variable. 
    Scale Number of decimal places in a numeric variable. 
    Length Name of a four-byte variable that will contain the actual length of the data in Buffer. 
      

  2.   

    在上面的问题中已经将Modify设为TRUE,但仍不能解决问题。
    请高手了却我的烦恼