Demo entry 5323217

ff

   

Submitted by ff on Jun 16, 2016 at 03:19
Language: C++. Code size: 569 Bytes.

//学生登录数据库查询
   strSQL = "SELECT count(*) FROM STUDENTUSER where USERNAME1 ='";
   strSQL = strSQL + m_username + "' and PASSWORD1='";
   strSQL = strSQL + m_password + "'";//字符串拼接
   m_pRecordset = m_pConnection->Execute(( _bstr_t)strSQL,&ra,adCmdText);
   vCount = m_pRecordset->GetCollect((_variant_t)(long)(0)); //取得第一个字段的值放入vCount变量
   if(vCount.lVal>0)//是否有记录
   {
	  AfxMessageBox("登录成功!");//界面跳转
      if(dlg10->GetSafeHwnd()==0)
		 dlg10->Create(IDD_DIALOG10);
	  dlg10->ShowWindow(SW_SHOW);
	}
	else
	{
	    AfxMessageBox("用户名或密码错误,请重新输入!");
	}

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).