Click here to Skip to main content
15,897,273 members
Articles / Web Development / ASP.NET

Web-based Data Access Object for Unmanaged Application

Rate me:
Please Sign up or sign in to vote.
4.81/5 (5 votes)
25 Apr 2013CPOL3 min read 18K   204   13  
Unmanaged code application accessing data in a database via Web Services without a database provider.
// WebDAO.h: interface for the CWebDAO class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_WEBDAO_H__38F3675C_9A57_4CE2_A802_9D13D502C120__INCLUDED_)
#define AFX_WEBDAO_H__38F3675C_9A57_4CE2_A802_9D13D502C120__INCLUDED_

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

#import "WebDAO.tlb" named_guids raw_interfaces_only

class CWebDAO  
{
public:
	int ExecuteNonQuery(CString strSQL);
	CString GetFieldNameByColumnNo(int nColumnNo);
	int GetColumnSize(void);
	int GetRecordCount(void);
	int GetNumberByColumnNo(int nColumnNo);
	CString GetStringByColumnNo(int nColumnNo);
	BOOL MoveNext();
	BOOL Close();
	BOOL GetBlobFieldValue(CString strFieldName, DWORD dwDataSize, CString strSaveFileName);
	BOOL IsEOF();
	BOOL GetFieldValue(CString strFieldName, double &dValue);
	BOOL GetFieldValue(CString strFieldName, float &fValue);
	BOOL GetFieldValue(CString strFieldName, long  &lValue);
	BOOL GetFieldValue(CString strFieldName, int &nValue);
	BOOL GetFieldValue(CString strFieldName, CString &strValue);
	BOOL Open(CString strSQL, BOOL bOnlyTableName = FALSE, BOOL bBlob = FALSE, BOOL bUseClient = FALSE);
	BOOL bCOMInitailzed;
	BOOL Initialize();
	WebDAO::IWebDatabaseAccessObjectPtr m_pDotNetCOMPtr;
	CWebDAO(CString strConnection);
	CWebDAO();
	virtual ~CWebDAO();

protected:
	BOOL GetBlobFieldValue(CString strFieldName, DWORD dwDataSize, char *pData);

};

#endif // !defined(AFX_WEBDAO_H__38F3675C_9A57_4CE2_A802_9D13D502C120__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Korea (Republic of) Korea (Republic of)
Software Engineer.

Comments and Discussions