Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

accessÖÐlikeд·¨

sqlÓï¾äÊÇÕâÑùдµÃ 
string sql = "select * from shophistory where username(stringÀàÐÍ)¡¡like '%"+ name +"%' ";
½á¹ûÔËÐб¨´í£º(²Ù×÷·û¶ªÊ§) ÔÚ²éѯ±í´ïʽ  ˵ºó°ë¶ÎÓдíÎó like '%"+ name +"%' ";

²é¹ýÍøÉÏ×ÊÁÏ ËµÊÇÓÃ* #»ò ?¶¼ÐÐ £¬µ«ÔÚvs2005ÖÐ ÈçÓõÄÊÇOleDbDataAdapter »¹ÊÇÓðٷֺţ¿²»ÖªµÀ¸ÃÈçºÎÐ޸ģ¿ÔÚÏߵȼ±£¡£¡
ÁíÍâÔÙÎÊÒ»ÏÂaccessÖÐ Îı¾ºÍ±¸×¢ 2¸öÊÇ·ñ¶¼ÄÜÓÃlikeÄ£ºý²éѯ£¿ÈçÊÇÓï·¨ÊÇ·ñ¾ÍÊÇÓëÎÒÉÏÃæÐ´µÄÒ»Ñù£¿

*

ºý²éѯÓëbetween and
AccessÓë SqlServer  ,Oracle  ²»Í¬µÄµØ·½
Select * from ±í where  ×Ö¶Î1  like '*aa*'      aaÊÇÄãÊäÈëµÄ×Ö·û  *ÊDZØÐëÊäÈëµÄ¸ñʽ
Select * from ±í where  ×Ö¶Î2  between #3#  and  #33#      ×Ö¶Î2  ÔÚ3ºÍ33Ö®¼ä  #ÊDZØÐëÊäÈëµÄ¸ñʽ

select * from ±íÃû where ×Ö¶ÎÃû like '*abc*'


C# code:

//ʹÓòÎÊý
sql = "SELECT * from tt where aa like '%'+@t1+'%'";



ÒýÓÃ
ºý²éѯÓëbetween and
AccessÓë SqlServer  ,Oracle  ²»Í¬µÄµØ·½
Select * from ±í where  ×Ö¶Î1  like '*aa*'      aaÊÇÄãÊäÈëµÄ×Ö·û  *ÊDZØÐëÊäÈëµÄ¸ñʽ
Select * from ±í where  ×Ö¶Î2  between #3#  and  #33#


Ïà¹ØÎÊ´ð£º

asp¸úAccessÊý¾ÝÁ¬½ÓÎÊÌâ¡£

IsSqlDataBase = 0 'Ö÷Êý¾Ý¿âÀàÐÍ(1=SQL£¬0=AC)

'===========================================================================
SqlDatabaseName = "ads365" 'Ö÷Êý¾Ý¿âÃû
S ......

ÓÃVBÇóACCESSÁ½¸ö±íµÄºÍ

ÓÃVBÇóACCESSÁ½¸ö±íµÄºÍ

a±íÀïÓÐ
ID Ãû³Æ ÊýÁ¿ ×ܼÛ
1  a    13  11
2  c    20  20
3  c    2    52
4  b&nb ......

ÔÚÒ»ÕÅaccess±íÖÐǶÌײéѯ

strSQLCmd.Format(_T("select * from (select * from talk_info where %s ='%s') where %s ='%s'"),
strVar,strValue,strVar2,strValue2);
ÇëÎÊÕâÓï¾äÓÐÎÊÌâÂð
ûÓÐÎÊÌâ¡£
......

access±íÖÐʱ¼ä²îµÄÉú³É

access±íÖÐÓÐ3¸ö×ֶΣ¬starttime£¬endtime£¬timespan£¬
ÊäÈëǰÁ½¸öÖµºóÔõô×Ô¶¯Éú³ÉtimespanÄØ
´´½¨²éѯ¡£

select *, endtime-starttime from your table


»òÕßÔÚÄãµÄÊäÈë´°ÌåÖÐÓÃVBA´úÂëʵÏÖ¡ ......

Çë¸øÒ»¸öACCESS¶àÌõ¼þ²éѯµÄÀý×Ó

Çë¸øÒ»¸öACCESS¶àÌõ¼þ²éѯµÄÀý×Ó,×Ö¶Î:ÐÕÃû,µç»°,¹«Ë¾,µØÖ·Îª²éѯÌõ¼þ,Ö»Òª²»Îª¿Õ,¾Í×÷Ϊ²éѯÌõ¼þ.
ÄãÏÈ給這個Щ×Ö¶Î設ÖÃ變Á¿並賦³õÖµ為:%,
ÔÙÔÚ²é詢 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ