以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  type 'Guid' to type 'String' is not valid的错误  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=166124)

--  作者:newsun2k
--  发布时间:2021/5/19 15:46:00
--  type 'Guid' to type 'String' is not valid的错误
Dim strCn As String
strCn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Vars("gsCpcMs") & "\\cpms.mdb;Persist Security Info=False;Jet OLEDB:Database Password=123"
Connections.Add("cpcDB",strCn)
Dim cmd As new SQLCommand
cmd.C
cmd.CommandText = "sel ect * from DZSQ_KHD_SHENQINGXX wh ere SHENQINGH <> \'\' and SHENQINGH is not null"
Dim dt As DataTable = cmd.ExecuteReader
Dim drNew As DataRow
For Each dr As DataRow In dt.DataRows
    drNew = DataTables("rdCPC申请信息").addnew
    drNew("申请编号") = dr("SHENQINGBH")     
next


红色字体部分报错:
Exception has been thrown by the target of an invocation.
Conversion from type \'Guid\' to type \'String\' is not valid.

加cstr()也不行。

咋整?

--  作者:newsun2k
--  发布时间:2021/5/19 15:59:00
--  
改成tostring解决了。
但是从access中读日期,怎么老是读成了0001-01-01

--  作者:有点蓝
--  发布时间:2021/5/20 8:40:00
--  
没有值默认就是0001-01-01