ÈçºÎͨ¹ý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
Ïà¹ØÎÊ´ð£º
ϵͳÿÌì²úÉúÒ»¸öexcelÎļþ£¬¸ñʽÏàͬ£¬ÄÚÈÝÓÃÎļþÃû£¨ÓòúÉúµÄʱ¼äÃüÃû£©Çø·Ö¡£ÎÒ×öÁËÒ»¸öaccessÊý¾Ý¿â£¬µ¼ÈëexcelµÄÊý¾Ý£¬ÎÒÏë¼ÓÒ»Ïî¼Í¼ÎļþÃûÀ´Çø·ÖÄÚÈÝ£¬¿ÉÊÇÔõô×öÄØ£¿ÓÖ»òÕßÓÃʲôÆäËû·½·¨¿ÉÒÔ°ìµ½£¿Ð»ÁË
Äã ......
VB+Access×öµÄϵ統£¬
Ôõ樣°Ñ數據庫Access內ÈÝ導³öexecl£¿
ÏÖÔÚû¶«Î÷ÊÔ£¬´ÓÍøÉÏÕÒÁ˶δúÂëÄã¿´¿´
VB code:
Private Sub ExportOneTable()
'EXPORTS TABLE IN ......
´ÓÀàÐÍ"DBNULL" µ½ÀàÐÍ¡°Double¡±µÄת»»ÎÞЧ£¨Êý¾Ý¿âÖжÔÓ¦µÄ a3 »òa5 ûÓÐÊý¾ÝÊÇΪ¿Õ£©
,ÇëÎÊÎÒÔõô´¦Àí£¡
VB.NET code:
Dim a1 As String = Nothing
Dim a2 As S ......
Çë½Ì
ÔÚaccessÖÐ ÎÒÓбí1
id1 id2 id3 id4
1 2 3 0
2&nb ......
SQL code:
select count(1) from HouseList a left join MemberList b on
(a.OperationName=b.UName and a.Eid=1 and a.houselc='2')
ÒÔÉÏÕâÌõÓï¾äÔÚsql2005ÖвéѯµÃµ½760Ìõ¼Ç¼,·ÅÔÚaccessÖвéѯֻÓÐ14Ì ......