//部分添加管理信息相关代码:
_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",_variant_t(m_Acc));
pRentRecordset->PutCollect("M_Password",_variant_t(m_Pas)
题库管理系统(部分代码)
最新推荐文章于 2025-10-26 08:29:56 发布
这段代码展示了如何使用ADO操作数据库进行题库管理,包括添加管理信息、删除管理员及其关联记录,并实现了随机抽取选择题和简答题写入TXT文件的功能。

最低0.47元/天 解锁文章
1884

被折叠的 条评论
为什么被折叠?



