以文本方式查看主题 - Foxtable(狐表) (http://www.foxtable.com/bbs/index.asp) -- 专家坐堂 (http://www.foxtable.com/bbs/list.asp?boardid=2) ---- [求助]一个时间设置的问题!!!!! (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=21147) |
-- 作者:gaoyong30000 -- 发布时间:2012/7/3 9:44:00 -- [求助]一个时间设置的问题!!!!! Dim b1 As WinForm.Label = e.form.Controls("绩效录入与审查Label40") Dim b2 As WinForm.Label = e.form.Controls("绩效录入与审查Label41") Dim b3 As WinForm.Label = e.form.Controls("绩效录入与审查LabelA") Dim b4 As WinForm.Label = e.form.Controls("绩效录入与审查Label50") Dim b5 As WinForm.Label = e.form.Controls("绩效录入与审查Label51") b1.Text = Tables("绩效录入与审查_绩效录入与审查Table1").Compute("count(审核状态)", "审核状态 = 0 and SubString(Convert([检查日期],\'System.String\'),1,10) = #" & Functions.Execute("服务器时间") & "#") b2.Text = Tables("绩效录入与审查_绩效录入与审查Table1").Compute("count(审核状态)", "审核状态 = 0 and SubString(Convert([检查日期],\'System.String\'),1,10) < #" & Functions.Execute("服务器时间") & "#") b3.Text = Tables("绩效录入与审查_绩效录入与审查Table1").Compute("count(审核状态)", "SubString(Convert([检查日期],\'System.String\'),1,10) = #" & Functions.Execute("服务器时间") & "#") Dim n As Integer = Functions.Execute("服务器时间").DayOfWeek Dim d1 As Date = iif(n=0,Functions.Execute("服务器时间").Adddays(n-6),Functions.Execute("服务器时间").Adddays(1-n)) Dim d2 As Date = iif(n=0,Functions.Execute("服务器时间").Adddays(n),Functions.Execute("服务器时间").Adddays(7-n)) Dim d3 As Date = New Date(Functions.Execute("服务器时间").Year,Functions.Execute("服务器时间").month,1) Dim d4 As Date = New Date(Functions.Execute("服务器时间").Year,Functions.Execute("服务器时间").month,Date.DaysInMonth(Functions.Execute("服务器时间").Year,Functions.Execute("服务器时间").Month)) b4.Text = Tables("绩效录入与审查_绩效录入与审查Table1").Compute("count(审核状态)","SubString(Convert([检查日期],\'System.String\'),1,10) > #" & d1.adddays(-1) & "# And SubString(Convert([检查日期],\'System.String\'),1,10) < #" & d2.adddays(1) & "#") b5.text = Tables("绩效录入与审查_绩效录入与审查Table1").Compute("count(审核状态)","SubString(Convert([检查日期],\'System.String\'),1,10) > #" & d3.AddDays(-1) & "# And SubString(Convert([检查日期],\'System.String\'),1,10) < #" & d4.AddDays(1) & "#") 以上代码是一个窗口的afterload里的,由于时间的问题 出现了这个错误!! 要在控制面板里 的区域与时间 改成yyyy-mm-dd才可以 请问如何改上面的代码予以解决~~~~~~
|
-- 作者:狐狸爸爸 -- 发布时间:2012/7/3 10:44:00 -- 我不明白,你为什么样这样:
检查日期这一列由什么特别的吗? 难道不能直接用来比较? [此贴子已经被作者于2012-7-3 10:45:00编辑过]
|
-- 作者:gaoyong30000 -- 发布时间:2012/7/3 11:26:00 -- 因为我之前用的sql数据源 其后台日期格式是这样的 |
-- 作者:gaoyong30000 -- 发布时间:2012/7/3 11:27:00 -- 目前access是这样的 我该怎么弄 不需要SubString(Convert([检查日期],\'System.String\'),1,10) 了??
|
-- 作者:狐狸爸爸 -- 发布时间:2012/7/3 11:34:00 -- 日期列的格式,本来就是这样的. 你字节使用就行,不需要转换的. |
-- 作者:gaoyong30000 -- 发布时间:2012/7/3 11:46:00 -- SubString就可以了? |
-- 作者:gaoyong30000 -- 发布时间:2012/7/3 11:46:00 -- 我这个access 连取字节都不需要吧~ |
-- 作者:狐狸爸爸 -- 发布时间:2012/7/3 11:55:00 -- b4.Text = Tables("绩效录入与审查_绩效录入与审查Table1").Compute("count(审核状态)","SubString(Convert([检查日期],\'System.String\'),1,10) > #" & d1.adddays(-1) & "# And SubString(Convert([检查日期],\'System.String\'),1,10) < #" & d2.adddays(1) & "#")
改为:
b4.Text = Tables("绩效录入与审查_绩效录入与审查Table1").Compute("count(审核状态)","[检查日期] > #" & d1.adddays(-1) & "# And [检查日期] < #" & d2.adddays(1) & "#") [此贴子已经被作者于2012-7-3 11:55:07编辑过]
|