首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

关于DTPicker连接一个日期的有关问题,请帮忙

2012-01-10 
关于DTPicker连接一个日期的问题,请帮忙我设置了4个DTPicker,分别为DTPicker1,DTPicker2,DTPicker3,DTPick

关于DTPicker连接一个日期的问题,请帮忙
我设置了4个DTPicker,分别为DTPicker1,DTPicker2,DTPicker3,DTPicker4.
StrSQL   =   "select   *   from   员工档案   where   "
str1=   "   入司时间   between   # "   &   DTPicker1.Value   &   "#   and   # "   &   DTPicker2.Value   &   "# "   &   " "
str2=   "   出生年月   between   # "   &   DTPicker3.Value   &   "#   and   # "   &   DTPicker4.Value   &   "# "   &   " "
怎样才能同时满足这两个条件实施查询??
我是这样写的StrSQL   =   StrSQL   &   str2   &   str1,系统提示语法错误,
要是这样的话  
StrSQL   =&   "   入司时间   between   # "   &   DTPicker1.Value   &   "#   and   # "   &   DTPicker2.Value   &   "# "   &   " "   and   & "   出生年月   between   # "   &   DTPicker3.Value   &   "#   and   # "   &   DTPicker4.Value   &   "# "   &   " "也是错误的
请帮帮忙.

[解决办法]
如果str1和str2都没错的话,那么用“and” 连接起来应该是没错的
建议在数据库中输入一个同时符合两个条件的记录试试

str1= " 入司时间 between # " & DTPicker1.Value & "# and # " & DTPicker2.Value & "# " & " "
str2= " 出生年月 between # " & DTPicker3.Value & "# and # " & DTPicker4.Value & "# " & " "

StrSQL = "select * from 员工档案 where " + str1 + " and " + str2


热点排行