易截截图软件、单文件、免安装、纯绿色、仅160KB

如何通过ADO使用聚合函数来查询(数据库为ACCESS)

_RecordsetPtr CMyAdo::SelectRecord(string &where, string &tablename,string &field, int way )
{
    int ret = 0;
  _RecordsetPtr pset;
CString  sql;
    VARIANT  count;
count.vt = VT_INT;
ret = OpenDB();
if( ret == 1 )
return -1;                    //创建对象失败
else if( ret == 2 )
  return -2;                    //数据库打开失败
try
{

    sql.Format("select count(*) from %s", tablename.c_str() );

    /*if( way == 0 )          //查询全部
{
sql.Format("select  * from %s", tablename.c_str() );
    TRACE("sql = %s\n",sql);
}
else if( way == 1 )      //按字段查询
sql.Format("select %s from %s", field.c_str(), tablename.c_str() );
else if( way == 2 )      //按条件全部查询
{

}
else if( way == 3 )      //按条件和字段联合查询
{

}*/
pset = m_dbptr->Execute((_bstr_t)sql.GetBuffer(sql.GetLength()),&count,adCmdUnknown);
if( pset != NULL && !pset->ADOEOF )
retu


相关问答:

access 中执行sql语句update不成功,求助!!!

access 中执行sql update语句时有时候成功有时候不成功,但是access中不出错误信息,不知道是什么原因,有哪位大侠知道,请帮忙啊
贴SQL语句,检查表、字段的有效性设置

sql 在查询分析器里面 执行很正常

是 ......

access中replace问题

我有一个Units表,结构为:
  ID              UnistsName
  UN1            黑龙江东方学院
  UN2      ......

access过滤问题,有请大侠们

sql语句:
SELECT  top 12  Forum.ID,Forum.topic,Reforum.id,Reforum.username,Reforum.posttime,Reforum.postip,Forum.username from Forum INNER JOIN Reforum ON Forum.ID = Reforum.topicid wher ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号