本案例通过VS2010 环境下的MFC ODBC 使用者连接SQL Server 数据库因为是通过ODBC 数据源连接的,在此我认为关于SQL Server 的版本是无关紧要的
数据库准备:--先要手动创建一个数据库,名字叫studentdb--创建好了数据库studentdb就可以执行下面的sql语句了--这些语句执行完了以后,会在studentdb中建一个student表,然后插入四条数据use studentdb;create table student(sno varchar(10),sname varchar(10) not null,sage int not null,pwd varchar(10) not null);insert into student(sno,sname,sage,pwd)values('0001','jack',20,'7777');insert into student(sno,sname,sage,pwd)values('0102','tom',20,'8888');insert into student(sno,sname,sage,pwd)values('3472','cat',20,'9999');insert into student(sno,sname,sage,pwd)values('5716','dog',20,'2013');--数据库建表工作就到这里这么顺利的完成了启动 VS2010,新建一个 MFC 项目
名称叫 summer
通过M FC 应用程序向导进行项目设置