以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]DateTimePicker类型转化无效  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=133590)

--  作者:bashanren
--  发布时间:2019/4/16 21:40:00
--  [求助]DateTimePicker类型转化无效
老师晚上辛苦!!
请老师帮忙看一下下面的代码,执行时,总是提示“dtp”类型转化无效,不知代码 dr2("进度终止日期") = "#dtp#"应该如何修改,谢老师指导!!

Dim str As String = e.form.controls("combobox2").Value
MessageBox.show(str)
Dim Cols1() As String = {"清单项目","工程名称","工程分部","单位","合同工程量","清单单价"}
Dim Cols2() As String = {"清单项目","工程名称","工程分部","单位","合同工程量","清单单价"}
For Each dr1 As DataRow In DataTables("清单目录").Select("[工程名称] = \'" & str & "\'")
    Dim dtp As WinForm.DateTimePicker = e.Form.Controls("DateTimePicker1")    
    Dim dr2 As DataRow = DataTables("合同执行").AddNew()    
    For Each dc As DataCol In DataTables("清单目录").DataCols        
        For i As Integer = 0 To Cols1.Length -1
            dr2(Cols2(i)) = dr1(Cols1(i))
            dr2("进度终止日期") = "#dtp#"            
        Next
    Next
Next

--  作者:有点蓝
--  发布时间:2019/4/16 21:55:00
--  
Dim str As String = e.form.controls("combobox2").Value
MessageBox.show(str)
Dim Cols1() As String = {"清单项目","工程名称","工程分部","单位","合同工程量","清单单价"}
Dim Cols2() As String = {"清单项目","工程名称","工程分部","单位","合同工程量","清单单价"}
Dim dtp As WinForm.DateTimePicker = e.Form.Controls("DateTimePicker1")
For Each dr1 As DataRow In DataTables("清单目录").Select("[工程名称] = \'" & str & "\'")
    Dim dr2 As DataRow = DataTables("合同执行").AddNew()
    dr2("进度终止日期") = dtp.Value
    For Each dc As DataCol In DataTables("清单目录").DataCols
        dr2(dc.Name)= dr1(dc.Name)
    Next
Next

--  作者:bashanren
--  发布时间:2019/4/16 22:12:00
--  
非常感谢老师,老师辛苦了!!!