//部分添加管理信息相关代码: _RecordsetPtr pRentRecordset; pRentRecordset.CreateInstance(_uuidof(Recordset)); HRESULT hr; _variant_t var; CString strValue; try { hr = pRentRecordset->Open("SELECT * FROM management", m_pConnection.GetInterfacePtr(), adOpenDynamic, adLockOptimistic, adCmdText); if (SUCCEEDED(hr)) { //查找有无同名的用户名 while (!pRentRecordset->adoEOF) { var = pRentRecordset->GetCollect((long)0); if (var.vt != VT_NULL) { strValue = (LPCSTR)_bstr_t(var); } strValue.TrimRight(); //转换成大写,因为SQL不分大小写 CString str = m_Acc; strValue.MakeUpper(); str.MakeUpper(); if (strValue == str) { MessageBox("已有该用户,请换新用户名/n(不分大小写)","消息提示"); pRentRecordset->Close(); return; } pRentRecordset->MoveNext(); } pRentRecordset->AddNew(); pRentRecordset->PutCollect("M_Account",_v
题库管理系统(部分代码)
最新推荐文章于 2024-05-20 17:04:39 发布