以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  BUG收集  (http://www.foxtable.com/bbs/list.asp?boardid=12)
----  日期控件取值导致的错误  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=12&id=158978)

--  作者:kb9702
--  发布时间:2020/12/9 9:39:00
--  日期控件取值导致的错误
Dim StrDate As WinForm.DateTimePicker = e.Form.Controls("StrDate")
If Tables("总装焊接指令_Table1").Rows.Count > 0 And Strdate.Text <> ""
    Dim cmd As New SQLCommand
    cmd.C
    Dim sql As String = "INSERT INTO [焊接指令] ( [开工日期], [序号],[计划日期], [需求分类], [产品图号], [生产], [CreatedTime]) OUTPUT Inserted._Identify  VALUES( \'"
    For Each r As Row In Tables("总装焊接指令_Table1").Rows
        If r("ID") = 0   Then
            cmd.CommandText = sql & StrDate.Value  & "\',\'" & r("序号") & "\',\'" & r("计划日期") & "\',\'" & r("需求分类") & "\',\'" & r("产品图号") & "\',\'" & r("生产")  &  "\',Getdate())"
            r("ID") = cmd.ExecuteScalar()
        Else
            MessageBox.Show(1)
        End If
    Next
End If

这个语句只插入表里的第一条数据,并且将后面的数据多删除了。。
将CommandText语句里的StrDate.Value 替换成StrDate.Text的时候就运行就正常了。。
折腾了半个多小时。。