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

📄 dsncollection.h

📁 枚举DNS数据源.可以用来获得计算机中所有的DNS数据源.本例主要利用CDSNCollection类.
💻 H
字号:
// DSNCollection.h: interface for the CDSNCollection class.
//
// Author:  Emil Gustafsson (e@ntier.se)
//          NTier Solutions (www.ntier.se)
// Created: 2000-06-14
//
// Description:
//			This class wraps a few calls to ODBC in order to collect
//			a set of DSNs.
//
//////////////////////////////////////////////////////////////////////

#ifndef DSNCOLLECTION_H
#define DSNCOLLECTION_H

#define DSNCOLLECTION_BUFLEN 128

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <afxdb.h> //Needed for SQLxxx defines and definitions.

class CDSNCollection  
{
public:
	// Constants used.
	static const unsigned char s_SYSTEM;
	static const unsigned char s_USER;

	// Constructors & destructors.
	CDSNCollection();
	virtual ~CDSNCollection();

protected:
	SQLHENV m_hSQLEnvironment;
	CString m_sErrorMsg;
	SQLRETURN m_iSQLResult;

	// Helper function.
	SQLRETURN CallSQLDataSources(CString& sName, SQLUSMALLINT direction);

public:
	// Get the first DSN. ucType should be s_SYSTEM, 
	// s_USER or a combination of both (s_SYSTEM|s_USER)
	// which is default.
	// Returns empty strings upon failure.
	CString GetFirstDSNName(unsigned char ucType = (s_SYSTEM | s_USER));
	
	// Get the next DSN in the enumeration sequence.
	// Returns empty strings upon failure.
	CString GetNextDSNName();

	// Retrieve the las error message (a formated string)
	CString GetErrorMessage() { return m_sErrorMsg; }

	// Retrieve the last result code from a SQL operation.
	SQLRETURN GetLastSQLResult() { return m_iSQLResult; }
};

#endif

⌨️ 快捷键说明

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