Some experiences about the ADO calls for the stored procedure (output parameters, return value)

xiaoxiao2021-03-06  42

In a project, I need to use the stored procedure to access the data, in order to provide a comparison interface for call, I didn't use createParameter (), but call the commandptr's refresh () function first query parameters from the database ._connectionptr m_pconn M_PConn.createInstance (__ uuidof (connection)); m_pconn-> open ("driver = {sql server}; server = 127.0.0.1; database = pub; uid = sa; pwd =", "," ", 0) ;

_CommandPtr m_pCommand; m_pCommand.CreateInstance (__ uuidof (Command)); _ RecordsetPtr m_pRecordset; m_pRecordset.CreateInstance (__ uuidof (Recordset)); m_pCommand-> ActiveConnection = m_pConn; m_pCommand-> CommandText = "SP_XX"; // name stored procedure m_pCommand-> PutcommandType (AdcmdStoredProc); m_pcommand-> parameters-> refresh (); // From database query parameter information

Next, you can assign each parameter: long cnt = m_pcommand-> parameters-> getCount (); // Number of values ​​of parameters for (long k = 1; k parameters-> GetItem (k) -> value = xxx; // to assign the parameter order in the parameter order of the stored procedure}

转载请注明原文地址:https://www.9cbs.com/read-78342.html

New Post(0)