一加上这一句就不行??? 先使用Open(CRecordset::snapshot)试试。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在isapi中用ado访问数据库1.ISAPI------need to add some lines to stdafx.h:#include <atlbase.h>#import "H:\\Program Files\\Common Files\\System\\ado\\msado15.dll" no_namespace rename("EOF", "EndOfFile")void CISAMExtension::Default(CHttpServerContext* pCtxt){ //GetListFrame(pCtxt); char mybuf[10240]; CoInitialize(NULL); try { _ConnectionPtr pConn("ADODB.Connection"); _RecordsetPtr pRst("ADODB.Recordset"); pConn->Open("Provider=sqloledb;Data Source=Server1;" "Initial Catalog=test1;User Id=sa;Password=sa;", "", "", adConnectUnspecified);// Note 1. pRst->Open( "userinfo", _variant_t((IDispatch *) pConn, true), adOpenStatic, adLockReadOnly, adCmdTable); pRst->MoveLast();// Note 2. sprintf(mybuf,"Last name is '%s %s'\n", (char*) ((_bstr_t) pRst->GetFields()->GetItem("username")->GetValue()), (char*) ((_bstr_t) pRst->Fields->Item["otherinfo"]->Value)); pRst->Close(); pConn->Close(); } catch (_com_error &e) { sprintf(mybuf,"Description = '%s'\n", (char*) e.Description()); } ::CoUninitialize();*pCtxt<<mybuf; } 看看这里http://codeguru.earthweb.com/isapi/index.shtml 看看这里http://codeguru.earthweb.com/isapi/index.shtml 用俺那个类不行吗?m$那套也是封装的odbc api啊。反正俺用得蛮好的。 如何设置GLTools的开发环境? 关于列表控件的问题,麻烦大人们看看 UDP通讯问题!!!!!!(急!!!!) 重画按钮的时候,如何让按钮保持按下的状态 谁能帮我建一个汽车的动力学数学模型? 请问在c++中如何生成一条曲线?(我是新手请不要笑话我) 请推荐一本LINUX下C编程书籍,谢谢! 公网的计算机是如何与局域网的某台计算机通信的 一个极难的问题!!!!!!!!!!!! 数据库高手come here vc下数据库编程问题 100分!谁有《电脑爱好者》第12期?先给20分,其它80分另开帖子给!以免浪费。谢了先!
1.ISAPI------need to add some lines to stdafx.h:
#include <atlbase.h>
#import "H:\\Program Files\\Common Files\\System\\ado\\msado15.dll" no_namespace rename("EOF", "EndOfFile")void CISAMExtension::Default(CHttpServerContext* pCtxt)
{
//GetListFrame(pCtxt);
char mybuf[10240];
CoInitialize(NULL);
try
{
_ConnectionPtr pConn("ADODB.Connection");
_RecordsetPtr pRst("ADODB.Recordset");
pConn->Open("Provider=sqloledb;Data Source=Server1;"
"Initial Catalog=test1;User Id=sa;Password=sa;",
"", "", adConnectUnspecified);
// Note 1.
pRst->Open(
"userinfo",
_variant_t((IDispatch *) pConn, true),
adOpenStatic,
adLockReadOnly,
adCmdTable);
pRst->MoveLast();
// Note 2.
sprintf(mybuf,"Last name is '%s %s'\n",
(char*) ((_bstr_t) pRst->GetFields()->GetItem("username")->GetValue()),
(char*) ((_bstr_t) pRst->Fields->Item["otherinfo"]->Value));
pRst->Close();
pConn->Close();
}
catch (_com_error &e)
{
sprintf(mybuf,"Description = '%s'\n", (char*) e.Description());
}
::CoUninitialize();
*pCtxt<<mybuf;
}
http://codeguru.earthweb.com/isapi/index.shtml
http://codeguru.earthweb.com/isapi/index.shtml
m$那套也是封装的odbc api啊。反正俺用得蛮好的。