哪位好大哥``给一个最简单的数据库编程实例给我啊`

小发猫 2004-12-06 08:28:56
``我天天上线等您的答复
...全文
82 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
DragonBill 2004-12-06
  • 打赏
  • 举报
回复
去http://www.vckbase.com上找找
老夏Max 2004-12-06
  • 打赏
  • 举报
回复
http://www.vckbase.net/document/listdoc.asp?mclsid=11
中到处都是
bohut 2004-12-06
  • 打赏
  • 举报
回复
http://www.vckbase.com/document/listdoc.asp?mclsid=11
下载例程,都可以编译的
gooyan 2004-12-06
  • 打赏
  • 举报
回复
1.stdafx.h中加入
#import "C:\Program Files\Common Files\System\ado\msado15.dll" no_namespace rename("EOF","adoEOF")
2。app文件的InitInstance中加入
if(S_OK!=OleInitialize(NULL))
{
AfxMessageBox("初始化COM组件库错误");
}


下面就是数据库操作
_ConnectionPtr pConn;
_RecordsetPtr pRs;
CString strSQL;
pConn.CreateInstance(__uuidof(Connection));
pConn->CursorLocation=adUseClient;
strSQL="Provider=SQLOLEDB;Server=Gooyan;DataBase=SkillsBox;UID=sa;PWD=aaaaaaaa";
pConn->Open(_bstr_t(strSQL),"","",-1);

pRs.CreateInstance(__uuidof(Recordset));
pRs->CursorLocation=adUseClient;
pRs->PutActiveConnection(pConn.GetInterfacePtr());

pRs1.CreateInstance(__uuidof(Recordset));
pRs1->CursorLocation=adUseClient;
pRs1->PutActiveConnection(pConn.GetInterfacePtr());

strSQL="select * from catalog order by cataid";
pRs->Open(_bstr_t(strSQL),vtMissing,adOpenDynamic,adLockBatchOptimistic,adCmdText);

yanw0212 2004-12-06
  • 打赏
  • 举报
回复
http://www.vckbase.com,
有好多的Demo,什么样的都有!

4,012

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 数据库
社区管理员
  • 数据库
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧