以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 从字符串“预计开工日期”到类型“Date”的转换无效 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=149300) |
-- 作者:季朝龙 -- 发布时间:2020/4/28 13:49:00 -- 从字符串“预计开工日期”到类型“Date”的转换无效 老师,我的DrawCell事件代码如下:正常情况系统不会显示错误,执行查询代码后出现错误信息为:“从字符串“预计开工日期”到类型“Date”的转换无效”,您给看看是什么情况? Dim r As Row = Tables("在制工单信息").Rows(e.Row.Index) Dim dt1 As Date = r("预计开工日期") Dim dt2 As Date = r("预计完工日期") Dim dt As Date = e.Col.Name.Replace("甘特图","").Replace("年","-").Replace("月_","-") Dim dt3 As Date = r("生产开工日期") Dim dt4 As Date = r("结单日期") Dim dt5 As Date = Date.Today Dim dt6 As Date = r("期望完工日期") \'Dim dt6 As String = r("订单状态") Dim dt0 As Date = e.Col.Name.Replace("甘特图","").Replace("年","-").Replace("月_","-") If dt = Date.Today Then e.StartDraw() e.Graphics.FillRectangle(Brushes.Pink,e.x + 1 ,e.y + 1, e.Width - 2, e.Height - 2) e.EndDraw() End If If r.IsNull("期望完工日期") Then If dt>=dt1 AndAlso dt<=dt2 Then e.StartDraw() e.Graphics.FillRectangle(Brushes.Yellow,e.x ,e.y + 3, e.Width, e.Height - 16) e.EndDraw() End If If r.IsNull("结单日期") Then If r.IsNull("生产开工日期") Then Else If dt0>dt2 Then If dt0>=dt3 AndAlso dt0<=dt5 Then e.StartDraw() e.Graphics.FillRectangle(Brushes.Coral,e.x ,e.y + 13, e.Width, e.Height - 16) e.EndDraw() End If Else If dt0<=dt2 Then If dt0>=dt3 AndAlso dt0<=dt5 Then e.StartDraw() e.Graphics.FillRectangle(Brushes.SpringGreen,e.x ,e.y + 13, e.Width, e.Height - 16) e.EndDraw() End If End If End If End If Else If dt>=dt1 AndAlso dt<=dt6 Then e.StartDraw() e.Graphics.FillRectangle(Brushes.Yellow,e.x ,e.y + 3, e.Width, e.Height - 16) e.EndDraw() End If If dt0>dt6 Then If dt0>=dt3 AndAlso dt0<=dt5 Then e.StartDraw() e.Graphics.FillRectangle(Brushes.Coral,e.x ,e.y + 13, e.Width, e.Height - 16) e.EndDraw() End If Else If dt0<=dt6 Then If dt0>=dt3 AndAlso dt0<=dt5 Then e.StartDraw() e.Graphics.FillRectangle(Brushes.SpringGreen,e.x ,e.y + 13, e.Width, e.Height - 16) e.EndDraw() End If End If End If
|
-- 作者:有点蓝 -- 发布时间:2020/4/28 14:33:00 -- 第一行加上 if Tables("在制工单信息").Rows.count = 0 then return
|