try
{
if(!m_pRecordset->BOF)
{
m_pRecordset->MoveFirst();
}
else
{
cout<<"???????"<<endl;
}
while(!m_pRecordset->adoEOF)
{
//var1=m_pRecordset->Fields->GetItem("USERNAME")->GetValue();
var1=m_pRecordset->GetCollect("USERNAME");
m_pRecordset->MoveNext();
if(var1.vt!=VT_NULL)
{
content=_com_util::ConvertBSTRToString((_bstr_t)var1);
}
cout<<"??????????????"<<content<<endl;
}
}
catch(_com_error *e)
{
cout<<e->ErrorMessage()<<endl;
}
break;
case 'd':
try
{
_variant_t RecordsAffected;
CString sql;
sql="delete * from DB_USER where USERID='3'";
m_pConnection->Execute((_bstr_t)sql??&RecordsAffected??adCmdText);
cout<<"????????"<<endl;
}
catch(_com_error *e)
{
cout<<e->ErrorMessage()<<endl;
return 0;
}
break;
case 'u':
try
{
_variant_t RecordsAffected;
CString sql;
sql="update DB_USER set EMAIL='cupt5634@126.com' where USERID=1";
m_pConnection->Execute((_bstr_t)sql??&RecordsAffected??adCmdText);
cout<<"???3????"<<endl;
break;
}
catch(_com_error *e)
{
cout<<e->ErrorMessage()<<endl;
return 0;
}
case 'a':
try
{
_variant_t  RecordsAffected;
CString sql;
sql="insert into DB_USER (USERNAME??PWD1??SEX??EMAIL??USERID)values ('Allen'??'1235698'??'?'??'698797@qq.com'??'3')";
m_pConnection->Execute((_bstr_t)sql??&RecordsAffected??adCmdText);
cout<<"???????????"<<endl;
}
catch(_com_error *e)
{
cout<<e->ErrorMessage()<<endl;
return 0;
}
break;
}
}