数据库小知识点

ADO数据库连接方法1    

BOOL ADO::Connect(void)
{
	try
	{
		m_pConnection.CreateInstance("ADODB.Connection");
		_bstr_t strConnect="driver={SQL Server Native Client 10.0};server=TWS-PC;uid=sa;pwd=123;database=Drill";
		m_pConnection->Open(strConnect,"","",adModeUnknown);

	}
	catch (_com_error &e)
	{
		CString strError;
		strError.Format(_T("连接数据库发生异常!\r\n错误信息显示:%s"),e.ErrorMessage());
		AfxMessageBox(strError);
		return FALSE;
	}
	return TRUE;
}


你可能感兴趣的:(数据库)