⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qrysoftdlg.cpp

📁 一个MFC软件,用来查询C语言常用函数,还连接了ACCESS数据库.
💻 CPP
📖 第 1 页 / 共 2 页
字号:

	pRst->Close();
	pConn->Close();
	pRst.Release();
	pConn.Release();

	CoUninitialize();	
}

void CQrySoftDlg::OnCha5() 
{
	// TODO: Add your control notification handler code here
	if(((CListBox*)GetDlgItem(IDC_LIST1))->GetCount() != 0)
		((CListBox*)GetDlgItem(IDC_LIST1))->ResetContent();

	CString p_str = "";
	p_str = "select name from qry where name like 'e%'";


 	CoInitialize(NULL);
	_ConnectionPtr pConn(__uuidof(Connection));
	_RecordsetPtr pRst(__uuidof(Recordset));
	pConn->ConnectionString = (_bstr_t)connStr;
	pConn->Open("", "", "", adConnectUnspecified);
	pRst = pConn->Execute((_bstr_t)p_str, NULL, adCmdText);

	while(!pRst->rsEOF)
	{
		((CListBox*)GetDlgItem(IDC_LIST1))->AddString((_bstr_t)pRst->GetCollect("name"));
		pRst->MoveNext();
	}

	pRst->Close();
	pConn->Close();
	pRst.Release();
	pConn.Release();

	CoUninitialize();	
}


void CQrySoftDlg::OnCha6()
{
	if(((CListBox*)GetDlgItem(IDC_LIST1))->GetCount() != 0)
		((CListBox*)GetDlgItem(IDC_LIST1))->ResetContent();

	CString p_str = "";
	p_str = "select name from qry where name like 'f%'";


 	CoInitialize(NULL);
	_ConnectionPtr pConn(__uuidof(Connection));
	_RecordsetPtr pRst(__uuidof(Recordset));
	pConn->ConnectionString = (_bstr_t)connStr;
	pConn->Open("", "", "", adConnectUnspecified);
	pRst = pConn->Execute((_bstr_t)p_str, NULL, adCmdText);

	while(!pRst->rsEOF)
	{
		((CListBox*)GetDlgItem(IDC_LIST1))->AddString((_bstr_t)pRst->GetCollect("name"));
		pRst->MoveNext();
	}

	pRst->Close();
	pConn->Close();
	pRst.Release();
	pConn.Release();

	CoUninitialize();	
}


void CQrySoftDlg::OnCha7()
{
	if(((CListBox*)GetDlgItem(IDC_LIST1))->GetCount() != 0)
		((CListBox*)GetDlgItem(IDC_LIST1))->ResetContent();

	CString p_str = "";
	p_str = "select name from qry where name like 'g%'";


 	CoInitialize(NULL);
	_ConnectionPtr pConn(__uuidof(Connection));
	_RecordsetPtr pRst(__uuidof(Recordset));
	pConn->ConnectionString = (_bstr_t)connStr;
	pConn->Open("", "", "", adConnectUnspecified);
	pRst = pConn->Execute((_bstr_t)p_str, NULL, adCmdText);

	while(!pRst->rsEOF)
	{
		((CListBox*)GetDlgItem(IDC_LIST1))->AddString((_bstr_t)pRst->GetCollect("name"));
		pRst->MoveNext();
	}

	pRst->Close();
	pConn->Close();
	pRst.Release();
	pConn.Release();

	CoUninitialize();	
}


void CQrySoftDlg::OnCha8()
{
	if(((CListBox*)GetDlgItem(IDC_LIST1))->GetCount() != 0)
		((CListBox*)GetDlgItem(IDC_LIST1))->ResetContent();

	CString p_str = "";
	p_str = "select name from qry where name like 'h%'";


 	CoInitialize(NULL);
	_ConnectionPtr pConn(__uuidof(Connection));
	_RecordsetPtr pRst(__uuidof(Recordset));
	pConn->ConnectionString = (_bstr_t)connStr;
	pConn->Open("", "", "", adConnectUnspecified);
	pRst = pConn->Execute((_bstr_t)p_str, NULL, adCmdText);

	while(!pRst->rsEOF)
	{
		((CListBox*)GetDlgItem(IDC_LIST1))->AddString((_bstr_t)pRst->GetCollect("name"));
		pRst->MoveNext();
	}

	pRst->Close();
	pConn->Close();
	pRst.Release();
	pConn.Release();

	CoUninitialize();	
}


void CQrySoftDlg::OnCha9()
{
	if(((CListBox*)GetDlgItem(IDC_LIST1))->GetCount() != 0)
		((CListBox*)GetDlgItem(IDC_LIST1))->ResetContent();

	CString p_str = "";
	p_str = "select name from qry where name like 'i%'";


 	CoInitialize(NULL);
	_ConnectionPtr pConn(__uuidof(Connection));
	_RecordsetPtr pRst(__uuidof(Recordset));
	pConn->ConnectionString = (_bstr_t)connStr;
	pConn->Open("", "", "", adConnectUnspecified);
	pRst = pConn->Execute((_bstr_t)p_str, NULL, adCmdText);

	while(!pRst->rsEOF)
	{
		((CListBox*)GetDlgItem(IDC_LIST1))->AddString((_bstr_t)pRst->GetCollect("name"));
		pRst->MoveNext();
	}

	pRst->Close();
	pConn->Close();
	pRst.Release();
	pConn.Release();

	CoUninitialize();	
}



void CQrySoftDlg::OnCha11()
{
	if(((CListBox*)GetDlgItem(IDC_LIST1))->GetCount() != 0)
		((CListBox*)GetDlgItem(IDC_LIST1))->ResetContent();

	CString p_str = "";
	p_str = "select name from qry where name like 'k%'";


 	CoInitialize(NULL);
	_ConnectionPtr pConn(__uuidof(Connection));
	_RecordsetPtr pRst(__uuidof(Recordset));
	pConn->ConnectionString = (_bstr_t)connStr;
	pConn->Open("", "", "", adConnectUnspecified);
	pRst = pConn->Execute((_bstr_t)p_str, NULL, adCmdText);

	while(!pRst->rsEOF)
	{
		((CListBox*)GetDlgItem(IDC_LIST1))->AddString((_bstr_t)pRst->GetCollect("name"));
		pRst->MoveNext();
	}

	pRst->Close();
	pConn->Close();
	pRst.Release();
	pConn.Release();

	CoUninitialize();	
}


void CQrySoftDlg::OnCha12()
{
	if(((CListBox*)GetDlgItem(IDC_LIST1))->GetCount() != 0)
		((CListBox*)GetDlgItem(IDC_LIST1))->ResetContent();

	CString p_str = "";
	p_str = "select name from qry where name like 'l%'";


 	CoInitialize(NULL);
	_ConnectionPtr pConn(__uuidof(Connection));
	_RecordsetPtr pRst(__uuidof(Recordset));
	pConn->ConnectionString = (_bstr_t)connStr;
	pConn->Open("", "", "", adConnectUnspecified);
	pRst = pConn->Execute((_bstr_t)p_str, NULL, adCmdText);

	while(!pRst->rsEOF)
	{
		((CListBox*)GetDlgItem(IDC_LIST1))->AddString((_bstr_t)pRst->GetCollect("name"));
		pRst->MoveNext();
	}

	pRst->Close();
	pConn->Close();
	pRst.Release();
	pConn.Release();

	CoUninitialize();	
}


void CQrySoftDlg::OnCha13()
{
	if(((CListBox*)GetDlgItem(IDC_LIST1))->GetCount() != 0)
		((CListBox*)GetDlgItem(IDC_LIST1))->ResetContent();

	CString p_str = "";
	p_str = "select name from qry where name like 'm%'";


 	CoInitialize(NULL);
	_ConnectionPtr pConn(__uuidof(Connection));
	_RecordsetPtr pRst(__uuidof(Recordset));
	pConn->ConnectionString = (_bstr_t)connStr;
	pConn->Open("", "", "", adConnectUnspecified);
	pRst = pConn->Execute((_bstr_t)p_str, NULL, adCmdText);

	while(!pRst->rsEOF)
	{
		((CListBox*)GetDlgItem(IDC_LIST1))->AddString((_bstr_t)pRst->GetCollect("name"));
		pRst->MoveNext();
	}

	pRst->Close();
	pConn->Close();
	pRst.Release();
	pConn.Release();

	CoUninitialize();	
}


void CQrySoftDlg::OnCha14()
{
	if(((CListBox*)GetDlgItem(IDC_LIST1))->GetCount() != 0)
		((CListBox*)GetDlgItem(IDC_LIST1))->ResetContent();

	CString p_str = "";
	p_str = "select name from qry where name like 'n%'";


 	CoInitialize(NULL);
	_ConnectionPtr pConn(__uuidof(Connection));
	_RecordsetPtr pRst(__uuidof(Recordset));
	pConn->ConnectionString = (_bstr_t)connStr;
	pConn->Open("", "", "", adConnectUnspecified);
	pRst = pConn->Execute((_bstr_t)p_str, NULL, adCmdText);

	while(!pRst->rsEOF)
	{
		((CListBox*)GetDlgItem(IDC_LIST1))->AddString((_bstr_t)pRst->GetCollect("name"));
		pRst->MoveNext();
	}

	pRst->Close();
	pConn->Close();
	pRst.Release();
	pConn.Release();

	CoUninitialize();	
}

void CQrySoftDlg::OnCha15() 
{
	// TODO: Add your control notification handler code here
	if(((CListBox*)GetDlgItem(IDC_LIST1))->GetCount() != 0)
		((CListBox*)GetDlgItem(IDC_LIST1))->ResetContent();

	CString p_str = "";
	p_str = "select name from qry where name like 'o%'";


 	CoInitialize(NULL);
	_ConnectionPtr pConn(__uuidof(Connection));
	_RecordsetPtr pRst(__uuidof(Recordset));
	pConn->ConnectionString = (_bstr_t)connStr;
	pConn->Open("", "", "", adConnectUnspecified);
	pRst = pConn->Execute((_bstr_t)p_str, NULL, adCmdText);

	while(!pRst->rsEOF)
	{
		((CListBox*)GetDlgItem(IDC_LIST1))->AddString((_bstr_t)pRst->GetCollect("name"));
		pRst->MoveNext();
	}

	pRst->Close();
	pConn->Close();
	pRst.Release();
	pConn.Release();

	CoUninitialize();		
}

void CQrySoftDlg::OnCha16() 
{
	// TODO: Add your control notification handler code here
	if(((CListBox*)GetDlgItem(IDC_LIST1))->GetCount() != 0)
		((CListBox*)GetDlgItem(IDC_LIST1))->ResetContent();

	CString p_str = "";
	p_str = "select name from qry where name like 'p%'";


 	CoInitialize(NULL);
	_ConnectionPtr pConn(__uuidof(Connection));
	_RecordsetPtr pRst(__uuidof(Recordset));
	pConn->ConnectionString = (_bstr_t)connStr;
	pConn->Open("", "", "", adConnectUnspecified);
	pRst = pConn->Execute((_bstr_t)p_str, NULL, adCmdText);

	while(!pRst->rsEOF)
	{
		((CListBox*)GetDlgItem(IDC_LIST1))->AddString((_bstr_t)pRst->GetCollect("name"));
		pRst->MoveNext();
	}

	pRst->Close();
	pConn->Close();
	pRst.Release();
	pConn.Release();

	CoUninitialize();		
}

void CQrySoftDlg::OnCha17() 
{
	// TODO: Add your control notification handler code here
	if(((CListBox*)GetDlgItem(IDC_LIST1))->GetCount() != 0)
		((CListBox*)GetDlgItem(IDC_LIST1))->ResetContent();

	CString p_str = "";
	p_str = "select name from qry where name like 'q%'";


 	CoInitialize(NULL);
	_ConnectionPtr pConn(__uuidof(Connection));
	_RecordsetPtr pRst(__uuidof(Recordset));
	pConn->ConnectionString = (_bstr_t)connStr;
	pConn->Open("", "", "", adConnectUnspecified);
	pRst = pConn->Execute((_bstr_t)p_str, NULL, adCmdText);

	while(!pRst->rsEOF)
	{
		((CListBox*)GetDlgItem(IDC_LIST1))->AddString((_bstr_t)pRst->GetCollect("name"));
		pRst->MoveNext();
	}

	pRst->Close();
	pConn->Close();
	pRst.Release();
	pConn.Release();

	CoUninitialize();		
}

void CQrySoftDlg::OnCha18() 
{
	// TODO: Add your control notification handler code here
	if(((CListBox*)GetDlgItem(IDC_LIST1))->GetCount() != 0)
		((CListBox*)GetDlgItem(IDC_LIST1))->ResetContent();

	CString p_str = "";
	p_str = "select name from qry where name like 'r%'";


 	CoInitialize(NULL);
	_ConnectionPtr pConn(__uuidof(Connection));
	_RecordsetPtr pRst(__uuidof(Recordset));
	pConn->ConnectionString = (_bstr_t)connStr;
	pConn->Open("", "", "", adConnectUnspecified);
	pRst = pConn->Execute((_bstr_t)p_str, NULL, adCmdText);

	while(!pRst->rsEOF)
	{
		((CListBox*)GetDlgItem(IDC_LIST1))->AddString((_bstr_t)pRst->GetCollect("name"));
		pRst->MoveNext();
	}

	pRst->Close();
	pConn->Close();
	pRst.Release();
	pConn.Release();

	CoUninitialize();		
}

void CQrySoftDlg::OnCha19() 
{
	// TODO: Add your control notification handler code here
	if(((CListBox*)GetDlgItem(IDC_LIST1))->GetCount() != 0)
		((CListBox*)GetDlgItem(IDC_LIST1))->ResetContent();

	CString p_str = "";
	p_str = "select name from qry where name like 's%'";


 	CoInitialize(NULL);
	_ConnectionPtr pConn(__uuidof(Connection));
	_RecordsetPtr pRst(__uuidof(Recordset));
	pConn->ConnectionString = (_bstr_t)connStr;
	pConn->Open("", "", "", adConnectUnspecified);
	pRst = pConn->Execute((_bstr_t)p_str, NULL, adCmdText);

	while(!pRst->rsEOF)
	{
		((CListBox*)GetDlgItem(IDC_LIST1))->AddString((_bstr_t)pRst->GetCollect("name"));
		pRst->MoveNext();
	}

	pRst->Close();
	pConn->Close();
	pRst.Release();
	pConn.Release();

	CoUninitialize();		
}

void CQrySoftDlg::OnCha20() 
{
	// TODO: Add your control notification handler code here
	if(((CListBox*)GetDlgItem(IDC_LIST1))->GetCount() != 0)
		((CListBox*)GetDlgItem(IDC_LIST1))->ResetContent();

	CString p_str = "";
	p_str = "select name from qry where name like 't%'";


 	CoInitialize(NULL);
	_ConnectionPtr pConn(__uuidof(Connection));
	_RecordsetPtr pRst(__uuidof(Recordset));
	pConn->ConnectionString = (_bstr_t)connStr;
	pConn->Open("", "", "", adConnectUnspecified);
	pRst = pConn->Execute((_bstr_t)p_str, NULL, adCmdText);

	while(!pRst->rsEOF)
	{
		((CListBox*)GetDlgItem(IDC_LIST1))->AddString((_bstr_t)pRst->GetCollect("name"));
		pRst->MoveNext();
	}

	pRst->Close();
	pConn->Close();
	pRst.Release();
	pConn.Release();

	CoUninitialize();		
}

void CQrySoftDlg::OnCha21() 
{
	// TODO: Add your control notification handler code here
	if(((CListBox*)GetDlgItem(IDC_LIST1))->GetCount() != 0)
		((CListBox*)GetDlgItem(IDC_LIST1))->ResetContent();

	CString p_str = "";
	p_str = "select name from qry where name like 'u%'";


 	CoInitialize(NULL);
	_ConnectionPtr pConn(__uuidof(Connection));
	_RecordsetPtr pRst(__uuidof(Recordset));
	pConn->ConnectionString = (_bstr_t)connStr;
	pConn->Open("", "", "", adConnectUnspecified);
	pRst = pConn->Execute((_bstr_t)p_str, NULL, adCmdText);

	while(!pRst->rsEOF)
	{
		((CListBox*)GetDlgItem(IDC_LIST1))->AddString((_bstr_t)pRst->GetCollect("name"));
		pRst->MoveNext();
	}

	pRst->Close();
	pConn->Close();
	pRst.Release();
	pConn.Release();

	CoUninitialize();		
}

void CQrySoftDlg::OnCha22() 
{
	// TODO: Add your control notification handler code here
	if(((CListBox*)GetDlgItem(IDC_LIST1))->GetCount() != 0)
		((CListBox*)GetDlgItem(IDC_LIST1))->ResetContent();

	CString p_str = "";
	p_str = "select name from qry where name like 'v%'";


 	CoInitialize(NULL);
	_ConnectionPtr pConn(__uuidof(Connection));
	_RecordsetPtr pRst(__uuidof(Recordset));
	pConn->ConnectionString = (_bstr_t)connStr;
	pConn->Open("", "", "", adConnectUnspecified);
	pRst = pConn->Execute((_bstr_t)p_str, NULL, adCmdText);

	while(!pRst->rsEOF)
	{
		((CListBox*)GetDlgItem(IDC_LIST1))->AddString((_bstr_t)pRst->GetCollect("name"));
		pRst->MoveNext();
	}

	pRst->Close();
	pConn->Close();
	pRst.Release();
	pConn.Release();

	CoUninitialize();		
}

void CQrySoftDlg::OnCha23() 
{
	// TODO: Add your control notification handler code here
	if(((CListBox*)GetDlgItem(IDC_LIST1))->GetCount() != 0)
		((CListBox*)GetDlgItem(IDC_LIST1))->ResetContent();

	CString p_str = "";
	p_str = "select name from qry where name like 'w%'";


 	CoInitialize(NULL);
	_ConnectionPtr pConn(__uuidof(Connection));
	_RecordsetPtr pRst(__uuidof(Recordset));
	pConn->ConnectionString = (_bstr_t)connStr;
	pConn->Open("", "", "", adConnectUnspecified);
	pRst = pConn->Execute((_bstr_t)p_str, NULL, adCmdText);

	while(!pRst->rsEOF)
	{
		((CListBox*)GetDlgItem(IDC_LIST1))->AddString((_bstr_t)pRst->GetCollect("name"));
		pRst->MoveNext();
	}

	pRst->Close();
	pConn->Close();
	pRst.Release();
	pConn.Release();

	CoUninitialize();		
}

void CQrySoftDlg::OnCha24() 
{
	// TODO: Add your control notification handler code here
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -