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+'%'";