如何通过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
相关问答:
IsSqlDataBase = 0 '主数据库类型(1=SQL,0=AC)
'===========================================================================
SqlDatabaseName = "ads365" '主数据库名
S ......
本来我是用ACCESS+VB建立一个软件(局域网),现在由于办公地点有变动,相换成INTERNAT的,有没有办法解决,
象这样的情况,如果是广域网,最好改成:B\S的
如果是局域网的,最好改成:C\S的
http://downlo ......
VB+Access做的系統,
怎樣把數據庫Access內容導出execl?
现在没东西试,从网上找了段代码你看看
VB code:
Private Sub ExportOneTable()
'EXPORTS TABLE IN ......
给access数据库加密的步骤如下:
(1)打开access软件,界面如图1所示
......
m_pConnect->BeginTrans();
strSql.Format("CREATE TABLE SysUser(lsh AUTOINCREMENT NOT NULL UNIQUE,PRIMARY KEY(lsh),userType BYTE)");
m_pConnect->Execute((_bstr_t)strSql,NULL, adExe ......