亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? readexceldlg.cpp

?? 這是VC++操作EXCEL的一個例子
?? CPP
字號:
// ReadExcelDlg.cpp : Implementierungsdatei
//
#include "stdafx.h"
#include "ReadExcel.h"
#include "ReadExcelDlg.h"
#include "odbcinst.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CReadExcelDlg Dialogfeld

CReadExcelDlg::CReadExcelDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CReadExcelDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CReadExcelDlg)
		// HINWEIS: Der Klassenassistent f黦t hier Member-Initialisierung ein
	//}}AFX_DATA_INIT
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CReadExcelDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CReadExcelDlg)
	DDX_Control(pDX, IDC_LIST1, m_ctrlList);
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CReadExcelDlg, CDialog)
	//{{AFX_MSG_MAP(CReadExcelDlg)
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CReadExcelDlg Nachrichten-Handler

BOOL CReadExcelDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	SetIcon(m_hIcon, TRUE);			// Gro遝s Symbol verwenden
	SetIcon(m_hIcon, FALSE);		// Kleines Symbol verwenden
	
	// ZU ERLEDIGEN: Hier zus鋞zliche Initialisierung einf黦en
	
	return TRUE;  // Geben Sie TRUE zur點k, au遝r ein Steuerelement soll den Fokus erhalten
}

// Wollen Sie Ihrem Dialogfeld eine Schaltfl鋍he "Minimieren" hinzuf黦en, ben鰐igen Sie 
//  den nachstehenden Code, um das Symbol zu zeichnen. F黵 MFC-Anwendungen, die das 
//  Dokument/Ansicht-Modell verwenden, wird dies automatisch f黵 Sie erledigt.

void CReadExcelDlg::OnPaint() 
{
	if (IsIconic())
	{
		CPaintDC dc(this); // Ger鋞ekontext f黵 Zeichnen

		SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

		// Symbol in Client-Rechteck zentrieren
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// Symbol zeichnen
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{
		CDialog::OnPaint();
	}
}

HCURSOR CReadExcelDlg::OnQueryDragIcon()
{
	return (HCURSOR) m_hIcon;
}



//******************************************************************
// Read that Excel Sheet
//******************************************************************
// The method OnButton1() and GetExcelDriver() demonstrate how
// an Excel file can be read. Besides that two more interesting
// features are demonstrated: 
//		1) The use of ODBC without having a complete DSN 
//       installed in the ODBC manager
//    2) The use of CRecordset without having a class 
//       derived from it
//
// But there have to be preparations:
//    You must have an Excel ODBC Driver installed (you 
//    wouldn磘 have guessed..). And there has to be database support,
//    so including <afxdb.h> is really not a bad idea. Last but
//    not least, if you want to determine the full name of that
//    Excel driver automagically (like I did in GetExcelDriver() )
//    you need "odbcinst.h" to be included also.
//
// And now for the drawbacks: 
//    Feature 1) only works with ODBC Admin V3.51 and higher. 
//    Earlier versions will not be able to use a DSN that actually
//    isn磘 installed. 
//    Feature 2) needs to be a readonly, foreward only recset.
//    So any attempts to change the data or to move back will 
//    fail horribly. If you need to do something like that you磖e
//    bound to use CRecordset the "usual" way. Another drawback is
//    that the tremendous overhead of CRecordset does in fact make
//    it rather slow. A solution to this would be using the class
//    CSQLDirect contributed by Dave Merner at codeguru磗
//    http://www.codeguru.com/mfc_database/direct_sql_with_odbc.shtml
//
// Corresponding articles:
//    For more stuff about writing into an Excel file or using a not
//    registered DSN please refer my article
//    http://www.codeguru.com/mfc_database/excel_sheets_using_odbc.shtml		
//
// There磗 still work to do:
//    One unsolved mystery in reading those files is how to get the
//    data WITHOUT having a name defined for it. That means
//    how can the structure of the data be retrieved, how many 
//    "tables" are in there, and so on. If you have any idea about 
//    that I磀 be glad to read it under almikula@EUnet.at (please 
//    make a CC to alexander.mikula@siemens.at)
//
//
// After my article at CodeGuru磗 concerning how to write into an Excel 
// file I got tons of requests about how to read from such a file. 
// Well in fact I do hope this - however enhancable - example sorts 
// out the basic questions.
//
//	Have fun!
//			Alexander Mikula - The Famous CyberRat	
//******************************************************************
void CReadExcelDlg::OnButton1() 
{
	CDatabase database;
	CString sSql;
	CString sItem1, sItem2;
	CString sDriver;
	CString sDsn;
	CString sFile = "ReadExcel.xls";		// the file name. Could also be something like C:\\Sheets\\WhatDoIKnow.xls
	
	// Clear the contents of the listbox
	m_ctrlList.ResetContent();
	
	// Retrieve the name of the Excel driver. This is 
	// necessary because Microsoft tends to use language
	// specific names like "Microsoft Excel Driver (*.xls)" versus
	// "Microsoft Excel Treiber (*.xls)"
	sDriver = GetExcelDriver();
	if( sDriver.IsEmpty() )
	{
		// Blast! We didn磘 find that driver!
		AfxMessageBox("No Excel ODBC driver found");
		return;
	}
	
	// Create a pseudo DSN including the name of the Driver and the Excel file
	// so we don磘 have to have an explicit DSN installed in our ODBC admin
	sDsn.Format("ODBC;DRIVER={%s};DSN='';DBQ=%s",sDriver,sFile);

	TRY
	{
		// Open the database using the former created pseudo DSN
		database.Open(NULL,false,false,sDsn);
		
		// Allocate the recordset
		CRecordset recset( &database );

		// Build the SQL string
		// Remember to name a section of data in the Excel sheet using "Insert->Names" to be
		// able to work with the data like you would with a table in a "real" database. There
		// may be more than one table contained in a worksheet.
		sSql = "SELECT field_1, field_2 "		
				 "FROM demo_table "					
				 "ORDER BY field_1";
	
		// Execute that query (implicitly by opening the recordset)
		recset.Open(CRecordset::forwardOnly,sSql,CRecordset::readOnly);

		// Browse the result
		while( !recset.IsEOF() )
		{
			// Read the result line
			recset.GetFieldValue("field_1",sItem1);
			recset.GetFieldValue("field_2",sItem2);

			// Insert result into the list
			m_ctrlList.AddString( sItem1 + " --> "+sItem2 );

			// Skip to the next resultline
			recset.MoveNext();
		}

		// Close the database
		database.Close();
							 
	}
	CATCH(CDBException, e)
	{
		// A database exception occured. Pop out the details...
		AfxMessageBox("Database error: "+e->m_strError);
	}
	END_CATCH;
}


// Get the name of the Excel-ODBC driver
CString CReadExcelDlg::GetExcelDriver()
{
	char szBuf[2001];
	WORD cbBufMax = 2000;
	WORD cbBufOut;
	char *pszBuf = szBuf;
	CString sDriver;

	// Get the names of the installed drivers ("odbcinst.h" has to be included )
   if(!SQLGetInstalledDrivers(szBuf,cbBufMax,& cbBufOut))
		return "";
	
	// Search for the driver...
	do
	{
		if( strstr( pszBuf, "Excel" ) != 0 )
		{
			// Found !
			sDriver = CString( pszBuf );
			break;
		}
		pszBuf = strchr( pszBuf, '\0' ) + 1;
	}
	while( pszBuf[1] != '\0' );

	return sDriver;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产成人av电影在线观看| 捆绑调教美女网站视频一区| 国产亚洲精品中文字幕| 欧美mv日韩mv亚洲| 日韩一区二区在线播放| 欧美一区二区三区视频免费播放| 欧美在线观看一区二区| 5566中文字幕一区二区电影| 欧美高清精品3d| 精品国产成人系列| 久久亚洲精品小早川怜子| 国产女同互慰高潮91漫画| 国产精品污www在线观看| 国产精品久久久久久福利一牛影视 | 国产精品区一区二区三区| 久久久综合激的五月天| 欧美国产欧美综合| 亚洲午夜在线电影| 麻豆国产欧美一区二区三区| 福利电影一区二区三区| 在线观看亚洲成人| 日韩三级精品电影久久久| 精品国产成人系列| 亚洲丝袜制服诱惑| 日本伊人午夜精品| 成人性视频免费网站| 欧美性三三影院| 欧美va日韩va| 亚洲色图都市小说| 蜜桃一区二区三区四区| caoporm超碰国产精品| 欧美一区二区三区成人| 欧美国产一区二区在线观看| 亚洲一区二区三区国产| 国产毛片一区二区| 欧美性大战久久久| 久久久亚洲精华液精华液精华液| 一区二区三区不卡视频在线观看| 蓝色福利精品导航| 精品视频999| 国产精品少妇自拍| 日本不卡一区二区三区| 色网站国产精品| 久久久www免费人成精品| 亚洲国产wwwccc36天堂| 成人理论电影网| 9191久久久久久久久久久| 国产精品久久久久久亚洲毛片| 日韩高清中文字幕一区| 色婷婷亚洲精品| 中文字幕av一区二区三区免费看| 首页国产欧美久久| 在线观看一区二区视频| 中文字幕一区二区在线播放| 免费成人av资源网| 欧美视频在线播放| 亚洲精品成a人| 波多野结衣精品在线| 国产日本欧美一区二区| 久久国产人妖系列| 91精品免费在线| 亚洲成年人网站在线观看| 日本丶国产丶欧美色综合| 国产精品国产三级国产普通话蜜臀| 久久成人免费日本黄色| 欧美一区二区私人影院日本| 亚洲123区在线观看| 欧美日韩免费观看一区三区| 亚洲综合一区二区三区| 91国在线观看| 亚洲成a人v欧美综合天堂下载 | 国产欧美综合色| 国产一区二区在线观看免费| 精品国产成人系列| 国产一区视频导航| 久久嫩草精品久久久精品一| 韩日欧美一区二区三区| 久久五月婷婷丁香社区| 国产精品一卡二卡在线观看| 精品久久久影院| 国产在线看一区| 欧美激情综合在线| 成人午夜短视频| 一区二区成人在线视频| 欧美日韩国产小视频在线观看| 午夜精品影院在线观看| 欧美成人激情免费网| 国产一区二区免费在线| 中文字幕不卡在线播放| 色婷婷av一区二区三区软件| 亚洲线精品一区二区三区| 51精品国自产在线| 国产一区在线观看视频| 综合分类小说区另类春色亚洲小说欧美 | 欧美xxxx在线观看| 国产成人免费网站| 一区二区三区高清不卡| 欧美一级免费大片| 国产成人精品亚洲午夜麻豆| 亚洲免费在线观看| 日韩一区二区在线看| 福利电影一区二区三区| 亚洲国产精品人人做人人爽| 日韩免费高清视频| 99国产精品国产精品久久| 亚洲bt欧美bt精品777| 久久欧美中文字幕| 欧美在线看片a免费观看| 麻豆国产91在线播放| 亚洲欧美日韩久久| 日韩午夜电影在线观看| 99久久免费国产| 美国十次了思思久久精品导航| 国产欧美一区二区精品久导航| 欧美日韩午夜在线视频| 国产成人a级片| 日韩国产一区二| 亚洲自拍另类综合| 精品88久久久久88久久久| 色乱码一区二区三区88 | 久久久亚洲精品石原莉奈| 欧美伊人久久久久久午夜久久久久| 美女网站视频久久| 亚洲一区自拍偷拍| 国产精品天天摸av网| 欧美sm美女调教| 欧美人xxxx| 色婷婷av久久久久久久| 成人一区二区三区视频| 精品一区二区国语对白| 天天操天天干天天综合网| 中文字幕一区二区三区四区不卡| 日韩美女一区二区三区四区| 欧洲色大大久久| 成人av在线资源| 成人免费高清在线| 国产高清视频一区| 国产专区欧美精品| 免费成人在线网站| 欧美a级一区二区| 天天色天天操综合| 天堂成人国产精品一区| 伊人一区二区三区| 亚洲欧美另类图片小说| 亚洲同性gay激情无套| 中文字幕一区二区5566日韩| 亚洲国产成人私人影院tom| 久久久一区二区三区| 精品免费国产二区三区| 精品伦理精品一区| 久久综合久久99| 久久影院电视剧免费观看| 精品欧美乱码久久久久久 | 在线观看成人小视频| 成人av影视在线观看| 成人国产在线观看| 99久久免费国产| 在线观看日韩毛片| 欧美丰满一区二区免费视频| 4hu四虎永久在线影院成人| 日韩三级视频在线看| 精品sm捆绑视频| 中文在线一区二区| 国产精品美女一区二区三区| 中文字幕一区av| 午夜久久久久久| 国产一区啦啦啦在线观看| 成人免费视频一区二区| 色一区在线观看| 欧美电影在线免费观看| 久久亚洲综合色一区二区三区| 国产欧美视频一区二区| 亚洲精品欧美专区| 日欧美一区二区| 国产成人精品三级麻豆| 色94色欧美sute亚洲线路二| 91麻豆精品国产91久久久更新时间| 日韩一区二区免费在线电影| 亚洲国产成人在线| 亚洲一区二区三区视频在线播放| 免费在线观看一区二区三区| 国产激情91久久精品导航| 一本到三区不卡视频| 欧美一级日韩一级| 国产精品久久久久一区| 亚洲电影一区二区三区| 国产主播一区二区三区| 在线日韩av片| 久久久精品综合| 亚洲一区在线观看免费观看电影高清| 日韩黄色免费电影| 成人永久aaa| 日韩欧美国产综合一区 | 精品免费国产二区三区| 中文字幕一区二区三区乱码在线| 日韩主播视频在线| 色悠久久久久综合欧美99| 日韩免费观看高清完整版在线观看| 亚洲啪啪综合av一区二区三区| 激情综合色丁香一区二区|