惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Attack and Defense Labs
Attack and Defense Labs
T
Threatpost
C
Cybersecurity and Infrastructure Security Agency CISA
H
Hackread – Cybersecurity News, Data Breaches, AI and More
I
Intezer
C
Cyber Attacks, Cyber Crime and Cyber Security
The Register - Security
The Register - Security
量子位
Security Latest
Security Latest
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
大猫的无限游戏
大猫的无限游戏
小众软件
小众软件
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
C
CXSECURITY Database RSS Feed - CXSecurity.com
MyScale Blog
MyScale Blog
J
Java Code Geeks
Apple Machine Learning Research
Apple Machine Learning Research
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
Spread Privacy
Spread Privacy
Jina AI
Jina AI
博客园 - 【当耐特】
P
Palo Alto Networks Blog
Last Week in AI
Last Week in AI
SecWiki News
SecWiki News
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
G
GRAHAM CLULEY
宝玉的分享
宝玉的分享
Hacker News - Newest:
Hacker News - Newest: "LLM"
T
The Blog of Author Tim Ferriss
V
Vulnerabilities – Threatpost
有赞技术团队
有赞技术团队
T
Tor Project blog
H
Hacker News: Front Page
A
Arctic Wolf
NISL@THU
NISL@THU
A
About on SuperTechFans
云风的 BLOG
云风的 BLOG
Engineering at Meta
Engineering at Meta
V
V2EX
N
News and Events Feed by Topic
Webroot Blog
Webroot Blog
Know Your Adversary
Know Your Adversary
P
Privacy International News Feed
I
InfoQ
D
Docker
L
LINUX DO - 最新话题
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
U
Unit 42

博客园 - Niyo Wong

用于主题检测的临时日志(f89708b9-f679-4391-af74-c92d9138aed4 - 3bfe001a-32de-4114-a6b4-4005b770f6d7) 测试用Word 2007发布博客 【转】ASP.NET Page事件的执行顺序 ASP.NET页面请求过程 JSP 执行过程 SQL Server 2005 错误处理笔记 .Net内存分配笔记 UML入门 与健康有约——送给每一个关心自己身体的人 .net 如何设置和检索特性信息(attribute) T-SQL编程基础-游标 .net中的4种事务总结 T-SQL编程基础-基本语法 Javascript调用服务器端事件 模式窗口页面不更新的问题 ASP.NET菜鸟进阶-Response.Write与RegisterXXX ASP.NET菜鸟进阶-页面间参数传递 差点把这好地儿给荒废了 我们的生活离不开笑
VC++(MFC)数据库程序——入门
Niyo Wong · 2007-12-18 · via 博客园 - Niyo Wong

刚开始学习VC,凭以往经验,先从数据库程序开始入门是最好的。简单,容易上手。在网上下载了几个例子,照着描红起来。几天下来自己也弄了几个例子。现在把自己的一点心得记下来:
1.在StdAfx.h中引入ado控件
#import "C:\Program Files\Common Files\System\ado\msado15.dll" no_namespace rename("EOF","rsEOF")
2.用AfxOleInit()初始化Com
if(!AfxOleInit())
 {
  AfxMessageBox("Ole Initialization failed!");
  return false;
 }
3._ConnectionPtr,_CommandPtr,_RecordSetPtr的使用
//define
_ConnectionPtr pConn;
_CommandPtr pCmd;
_RecordsetPtr pRst;
 pConn.CreateInstance(__uuidof(Connection));//
 pCmd.CreateInstance((__uuidof(Command)));

 pRst.CreateInstance((__uuidof(Recordset)));
//connection string
pConn->ConnectionString="Provider=SQLOLEDB.1;Password=;Persist Security Info=True;User ID=sa;Initial Catalog=pubs";
//open connection
try
{
    pConn->Open("","","",adModeUnknown);
}
catch(_com_error e)
{
    AfxMessageBox(e.ErrorMessage());
}
//execute sql, fill recordset
try
{
 pRst=pConn->Execute("select * from authors",NULL,adCmdText);  
}
catch(_com_error e)
{
 AfxMessageBox(e.ErrorMessage());
 return ;
}
//display data
try
{
  while(!pRst->rsEOF)
  {
    ((CListBox*)GetDlgItem(IDC_LIST1))->AddString((_bstr_t)pRst->GetCollect("au_lname"));
    pRst->MoveNext();
  }
}catch(_com_error *e)
{
 AfxMessageBox(e->ErrorMessage());
}