Home > Software engineering >  ADO operation UUID
ADO operation UUID

Time:10-05

When uuid contains 00, feel unable to realize the operation, not an error, but no action,
HTML code is as follows, when does not contain in the uuid 00, can normal execution, but contains 00, without exception not delete the data of actual, please advice, thank you!!!!
Bool _DB_DeletePatientInfo (cstrings t_sPatLogicID)
{
//determine database state, if there is no connection, the connection
If (! M_bDataBaseConnected)
{
If (! _DB_GetInTouchDatabase ())
{
return false;
}
}

//if the current record is open, the first close and NULL
If (m_pRecordset - & gt; State)
{
M_pRecordset - & gt; Close ();
}

//find patients
Cstrings TMP (" select * from Patient where PatLogicID=0 x ");//PatLogicID uuid
int i;
For (I=0; I & lt; 16. + + I)
{
Cstrings t_sAdd;
T_sAdd. The Format (" % x, "(BYTE) t_sPatLogicID. GetAt (I));
If (t_sAdd GetLength ()==1)
{
T_sAdd="0" + t_sAdd;
}
TMP=TMP + t_sAdd;
}

_bstr_t strSQL=TMP;

If (m_pRecordset - & gt; State)//if the current record is open, first to shut down and NULL
{
M_pRecordset - & gt; Close ();
}

Try
{
M_pRecordset - & gt; Open (_bstr_t (strSQL),
_variant_t ((IDispatch *) m_pConnection, true),
AdOpenStatic,
AdLockOptimistic,
AdCmdText);
}
Catch _com_error (e)
{
AfxMessageBox (_T (" SearchSampleInfo: can't uploaded to database "));
M_pConnection - & gt; Close ();
return false;
}

_variant_t TheValue;
TheValue=https://bbs.csdn.net/topics/m_pRecordset-> GetCollect (" PatNO ");
If (TheValue vt!=VT_NULL)
{
Cstrings PatNO=TheValue;//here you can read the id number of patients, and normal data can be obtained in m_pRecordset
}

//delete patients
If (m_pRecordset - & gt; AdoEOF)
{
AfxMessageBox (_T (" current no patients was chosen "));
return false;
}

Try//there is no error, is normal, but in the actual data is not deleted,
{
M_pRecordset - & gt; Delete (adAffectCurrent);
M_pRecordset - & gt; The Update ();
}
Catch _com_error (e)
{
AfxMessageBox (_T (" SearchSampleInfo: can't uploaded to database "));
M_pConnection - & gt; Close ();
return false;
}

return true;

CodePudding user response:

In addition, the development environment: vs2008 64 - bit Windows 7 mysql, 64
  • Related