我在重申一下: 1我在数据库中有 10个人的生日: 1978-12-02
1980-11-22
1981-12-15
1976-11-30
1977-11-12
.....
我想找出近半个月的过生日人的记录!
结果是:
1978-12-02
1976-11-30
只要生日在 11月30日 到12月14日都能提取出来
你们提的建议 都不能解决实际问题,解决的人多加分,其他人也加分
目前共150分,恳求帮助!!!!
这一贴连同
http://expert.csdn.net/Expert/topic/1215/1215350.xml?temp=3.852481E-02
贴
共150分
1980-11-22
1981-12-15
1976-11-30
1977-11-12
.....
我想找出近半个月的过生日人的记录!
结果是:
1978-12-02
1976-11-30
只要生日在 11月30日 到12月14日都能提取出来
你们提的建议 都不能解决实际问题,解决的人多加分,其他人也加分
目前共150分,恳求帮助!!!!
这一贴连同
http://expert.csdn.net/Expert/topic/1215/1215350.xml?temp=3.852481E-02
贴
共150分
解决方案 »
- 怎么查找在字符串A中第n次出现的字符串B?
- 关于赋值的一些问题
- 关于绘制波形图的问题
- 求救:请问在MSHFlexGrid控件中如何才能完整显示备注型字段值?关于MSHFlexGrid1.TextMatrix属性,取出的内容与数据库中的不同,被截成定长的
- 我做的网站
- 在VB中如何声明用VC写的DLL中的方法,使用的参数都是 char * 类型的,详情请进.急等!!!!!
- 请教访问Access2000数据库的一个问题
- 如何控制TextBox控件不能为空
- 如何把listbox1选中的数据转移到 listbox2
- 在VB中调用Delphi创建的ActiveX组件问题,在线等,解决立马送分
- 理解错了,重来。如何在记录集中判断查找“出生日期”字段近半个月的所有生日?
- 如何做一个浮动于桌面最上层的窗口,像金山词霸取词窗口那样
FROM table
where datediff("d" , "2002-11-29","2002-" & month(birthday) & "-" & day(birthday))<15 and
datediff("d" , "2002-11-29","2002-" & month(birthday) & "-" & day(birthday))>0
Form1.AutoRedraw = True
Dim Date1 As Date, Date2 As Date
Dim strDate1 As String, strDate2 As String
Dim strYear1 As String, strYear2 As String, strYear As String
Date1 = DateAdd("d", -15, Date)
Date2 = DateAdd("d", 15, Date)
strDate1 = Format(Date1, "mmdd")
strDate2 = Format(Date2, "mmdd")
strYear1 = Format(Date1, "yyyy")
strYear2 = Format(Date2, "yyyy")
strYear = Format(Date, "yyyy")
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim strSQL As String
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\abc.mdb;"
conn.Open
If strYear1 < strYear Or strYear2 > strYear Then
'如果此条件符合则说明当前日期的前后15天是跨年度的
strSQL = "select * from [Table1] where Format([birthday],'mmdd') between " & strDate1 & _
" and 1231 or Format([birthday],'mmdd') between 0101 and " & strDate2
Else
strSQL = "select * from [Table1] where Format([birthday],'mmdd') between " & strDate1 & _
" and " & strDate2
End If
rs.Open strSQL, conn, adOpenDynamic, adLockPessimistic
Do While Not rs.EOF
Print rs("birthday").Value
rs.MoveNext
Loop
End Sub