以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  日期怎么填入SQL数据库里?  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=146774)

--  作者:hongye
--  发布时间:2020/3/2 11:04:00
--  日期怎么填入SQL数据库里?
.NET Framework 版本:4.0.30319.42000
Foxtable 版本:2020.2.28.8
错误所在事件:窗口,核价系统窗口,Button3,Click
详细错误信息:
从字符串“”到类型“Date”的转换无效。
Dim dr As DataRow
dr = DataTables(fr & "订单核价系统").Find("客户 = \'" & kh.Value & "\'And 客户担当 = \'" & kd.Value & "\'And 类别 = \'" & lb.Value & "\'And 品名 = \'" & pm.Value & "\'And 款号 = \'" & ks.Value & "\'And 样衣款号 = \'" & yk.Value & "\'")
If dr("填报日期") = "" Then
    Dim drd As Date = Date.Today()
    dr("填报日期") = drd
End If


--  作者:有点蓝
--  发布时间:2020/3/2 11:36:00
--  
If dr.isnull("填报日期") Then
    Dim drd As Date = Date.Today()
    dr("填报日期") = drd
End If

单元格判断空值请使用isnull

--  作者:hongye
--  发布时间:2020/3/2 12:19:00
--  
Dim kh As WinForm.ComboBox = e.Form.Controls("ComboBox1")
Dim ht As WinForm.ComboBox = e.Form.Controls("ComboBox3")
Dim ks As WinForm.ComboBox = e.Form.Controls("ComboBox2")
Dim dd As WinForm.ComboBox = e.Form.Controls("ComboBox4")
Dim rq As WinForm.ComboBox = e.Form.Controls("ComboBox5")
If dd.text = ""
    If ks.Text = ""
        If kh.Text = ""
            If ht.Text = ""
                rq.ComboList = DataTables("核价系统主表_Table1").GetComboListString("填报日期","","填报日期")
            Else
                rq.ComboList = DataTables("核价系统主表_Table1").GetComboListString("填报日期","样衣款号 = \'" & ht.Text & "\'","填报日期")
            End If
        Else
            If ht.Text = ""
                rq.ComboList = DataTables("核价系统主表_Table1").GetComboListString("填报日期","客户 = \'" & kh.Text & "\'","填报日期")
            Else
                rq.ComboList = DataTables("核价系统主表_Table1").GetComboListString("填报日期","样衣款号 = \'" & ht.Text & "\'and 客户 = \'" & kh.Text & "\' ","填报日期")
            End If
        End If
    Else
        If kh.Text = ""
            If ht.Text = ""
                rq.ComboList = DataTables("核价系统主表_Table1").GetComboListString("填报日期","款号 = \'" & ks.Text & "\'","填报日期")
            Else
                rq.ComboList = DataTables("核价系统主表_Table1").GetComboListString("填报日期","样衣款号 = \'" & ht.Text & "\' and 款号 = \'" & ks.Text & "\'","填报日期")
            End If
        Else
            If ht.Text = ""
                rq.ComboList = DataTables("核价系统主表_Table1").GetComboListString("填报日期","客户 = \'" & kh.Text & "\'and 款号 = \'" & ks.Text & "\'","填报日期")
            Else
                rq.ComboList = DataTables("核价系统主表_Table1").GetComboListString("填报日期","样衣款号 = \'" & ht.Text & "\'and 客户 = \'" & kh.Text & "\'and 款号 = \'" & ks.Text & "\' ","填报日期")
            End If
        End If
    End If
Else
    If ks.Text = ""
        If kh.Text = ""
            If ht.Text = ""
                rq.ComboList = DataTables("核价系统主表_Table1").GetComboListString("填报日期","技术担当 = \'" & dd.text & "\'","填报日期")
            Else
                rq.ComboList = DataTables("核价系统主表_Table1").GetComboListString("填报日期","技术担当 = \'" & dd.text & "\' and 样衣款号 = \'" & ht.Text & "\'","填报日期")
            End If
        Else
            If ht.Text = ""
                rq.ComboList = DataTables("核价系统主表_Table1").GetComboListString("填报日期","技术担当 = \'" & dd.text & "\' and 客户 = \'" & kh.Text & "\'","填报日期")
            Else
                rq.ComboList = DataTables("核价系统主表_Table1").GetComboListString("填报日期","技术担当 = \'" & dd.text & "\' and 样衣款号 = \'" & ht.Text & "\'and 客户 = \'" & kh.Text & "\' ","填报日期")
            End If
        End If
    Else
        If kh.Text = ""
            If ht.Text = ""
                rq.ComboList = DataTables("核价系统主表_Table1").GetComboListString("填报日期","技术担当 = \'" & dd.text & "\' and 款号 = \'" & ks.Text & "\'","填报日期")
            Else
                rq.ComboList = DataTables("核价系统主表_Table1").GetComboListString("填报日期","技术担当 = \'" & dd.text & "\' and 样衣款号 = \'" & ht.Text & "\' and 款号 = \'" & ks.Text & "\'","填报日期")
            End If
        Else
            If ht.Text = ""
                rq.ComboList = DataTables("核价系统主表_Table1").GetComboListString("填报日期","技术担当 = \'" & dd.text & "\' and 客户 = \'" & kh.Text & "\'and 款号 = \'" & ks.Text & "\'","填报日期")
            Else
                rq.ComboList = DataTables("核价系统主表_Table1").GetComboListString("填报日期","技术担当 = \'" & dd.text & "\' and 样衣款号 = \'" & ht.Text & "\'and 客户 = \'" & kh.Text & "\'and 款号 = \'" & ks.Text & "\' ","填报日期")
            End If
        End If
    End If
End If

图片点击可在新窗口打开查看此主题相关图片如下:01.jpg
图片点击可在新窗口打开查看
如何去掉后面的0?



--  作者:有点蓝
--  发布时间:2020/3/2 13:32:00
--  
设置日期控件的“日期时间格式”http://www.foxtable.com/webhelp/topics/0797.htm
--  作者:hongye
--  发布时间:2020/3/2 13:39:00
--  
不知道如何写这个代码,请帮忙提示
--  作者:有点蓝
--  发布时间:2020/3/2 14:37:00
--  
rq.ComboList = DataTables("核价系统主表_Table1").GetComboListString("填报日期","","填报日期").replace(" 00:00:00","")