﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-sagiller</title><link>http://www.cppblog.com/sagiller/</link><description>sagiller's blog</description><language>zh-cn</language><lastBuildDate>Tue, 09 Jun 2026 23:57:53 GMT</lastBuildDate><pubDate>Tue, 09 Jun 2026 23:57:53 GMT</pubDate><ttl>60</ttl><item><title>access与c++的连接</title><link>http://www.cppblog.com/sagiller/archive/2011/02/14/140063.html</link><dc:creator>sagiller</dc:creator><author>sagiller</author><pubDate>Mon, 14 Feb 2011 15:34:00 GMT</pubDate><guid>http://www.cppblog.com/sagiller/archive/2011/02/14/140063.html</guid><wfw:comment>http://www.cppblog.com/sagiller/comments/140063.html</wfw:comment><comments>http://www.cppblog.com/sagiller/archive/2011/02/14/140063.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/sagiller/comments/commentRss/140063.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/sagiller/services/trackbacks/140063.html</trackback:ping><description><![CDATA[1.建立数据源
<div>数据库名student</div>
<div>表名student</div>
<div>字段</div>
<div>id&nbsp;<wbr>&nbsp;<wbr> 自动编号</div>
<div>name&nbsp;<wbr>文本</div>
<div>Gradeyear 数字</div>
<div>（数据自己插入）</div>
<div>&nbsp;<wbr></div>
<div>控制面版-&gt;管理工具-&gt;ODBC数据源-&gt;用户DSN-&gt;添加-&gt;Microsoft Access Driver-&gt;选择已经建立的数据库student</div>
<div>在数据源名中&nbsp;<wbr>&nbsp;<wbr> student（名字自己随意）</div>
<div>说明&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr> 学生
<div>&nbsp;</div>
<div>&nbsp;</div>
<wbr></div>
<div>2.编写应用程序</div>
<div>&nbsp;<wbr></div>
<div>打开vc++ -&gt;文件-&gt;项目-&gt;MFC Appwizard(exe)-&gt;在工程名称输入EX18a，然后确定</div>
<div>选择单文档并选英语，-&gt;查看数据库不使用文件支持-&gt;数据源选student(数据源名)-&gt;student（表名）-&gt;完成-&gt;确定</div>
<div>&nbsp;<wbr></div>
<div>3.增加控件</div>
<div>&nbsp;<wbr></div>
<div>在workspace窗口中可以看到一个名为：IDD_EX18A_FORM 的对话框，里面有一个静态文本控件，写着TODO:Place form controls on this dialog,点一下这个静态文本控件，按DELETE键删除掉，然后自己建如下如：</div>
<div>&nbsp;<wbr></div>
<div>静态文本&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr> 编辑框</div>
<div>
<div>静态文本&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr> 编辑框</div>
<div>
<div>静态文本&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr> 编辑框</div>
<div>&nbsp;<wbr></div>
<div>并改成</div>
<div>StudentID&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr> 编辑框</div>
<div>Name&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr>编辑框</div>
<div>Gradeyear&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr> 编辑框</div>
<div>&nbsp;<wbr></div>
<div>在对编辑框点右键选&nbsp;<wbr> 建立类向导</div>
<div>在点击Member Variables 在点击Add variable 在Add variable name 选好-&gt;m_StudentID,依次选好，在运行则可以看到数据库中的数据了</div>
</div>
</div>
<img src ="http://www.cppblog.com/sagiller/aggbug/140063.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/sagiller/" target="_blank">sagiller</a> 2011-02-14 23:34 <a href="http://www.cppblog.com/sagiller/archive/2011/02/14/140063.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>