Several issues of ADO operation data

xiaoxiao2021-03-06  66

Summarize several problems that are often met when using the ADO operational database. 1 Read the binary data in the database, someone mentioned in the forum with getchunk, only the image type of data, the following is an example of sound data: long ldataSize = m_adorecordSet.Getfields () -> GetItem ("sound") -> actualsize; if (ldatasize> 0) {_variant_t varblob; varblob = m_adorecordset.getfields () -> GetItem ("Sound") -> getChunk (LDataSize); if (varblob.vt == (vt_ARRAY | VT_UI1)) { char * pBuf = NULL; SafeArrayAccessData (varBLOB.parray, (void **) & pBuf); sndPlaySound (pBuf, SND_MEMORY | SND_SYNC | SND_NODEFAULT); // play sound SafeArrayUnaccessData (varBLOB.parray); // Note the phrase can not be missed }} 2 Introducing the ADO library in the DLL, using the following method to add #import "c: / program files / common files / system / program files / common files / system / ado / msado15.dll" NO_NAMESPACE RENAME ("EOF", "EOF", "EOF", "adoEOf") At the time, I may encounter some of the wrong information below, saying is EditModeenum, RecordStatusenum, ParameterDirectionNum, LockTyPeenum, DataTyPeenum, FieldattributeEnum, redifunity! Always compiled. In this case, you can try to change into #pragma Warning (Disable: 4146) #import "c: / program files / common files / system / ado / msado15.dll" named_guids rename ("EOF", "AdoEOF"), Rename ("BOF", "AdoBOF") # Pragma Warning (Default: 4146) Using Namespace AdoDB; 3 Read Write Time Values, the following is just a feasible method, there may be other better ways. Write time value COLEDATETIME OLEDATE = COLEDATETIME :: getcurrenttime (); _ variant_t vtfld; vtfld.vt = vt_date; vtfld.date = oledate; precordset-> PUTCOLLECT ("Birthday", VTFLD);

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

New Post(0)