以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 查找问题 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=169044) |
-- 作者:bzqlyj -- 发布时间:2021/5/31 10:34:00 -- 查找问题 drs = DataTables("表A").Select("(#" & d2 & "# <= lrsj <= #" & d1 & "#) and zt=\'T\'") 无法在 System.Boolean 和 System.DateTime 上执行“<=”操作。
|
-- 作者:有点蓝 -- 发布时间:2021/5/31 10:47:00 -- drs = DataTables("表A").Select("lrsj >=#" & d2 & "# and lrsj <= #" & d1 & "# and zt=\'T\'") |
-- 作者:bzqlyj -- 发布时间:2021/5/31 14:22:00 -- 回复:(有点蓝)drs = DataTables("表A").Select("lr... 请问,通过代码查找并写如表B中,对查找的数据与表B中的数据对比,重复的不写入表B中,不重复的写入表B中 Dim aa As WinForm.TextBox = e.Form.Controls("TextBox1") Dim d1 As Date = new Date(cint(aa.Value),12,31) Dim d2 As Date = new Date(cint(aa.Value),1,1) Dim d3 As Date =d1.AddYears(1) MessageBox.Show(d3) Dim drs As List(of DataRow) drs = DataTables("表A").Select("(lrsj<=#" & d1 & "# and zt=\'F\') or (jcsj>=#" & d2 & "# and jcsj <= #" & d3 & "#) and zt=\'T\'") Dim dr1 As DataRow For Each dr As DataRow In drs dr1 = DataTables("表B").AddNew dr1("年度") = d1.Year dr1("bh") = dr("bh") dr1("xly") = dr("xly") dr1("lrsj") =dr("lrsj") dr1("jcsj") = dr("jcsj") Next |
-- 作者:有点蓝 -- 发布时间:2021/5/31 14:42:00 -- For Each dr As DataRow In drs dr1 = DataTables("表B").Find("bh=\'" & dr("bh") & "\'") \'如果有多个查重的条件,自己补上 if dr1 is nothing then dr1 = DataTables("表B").AddNew dr1("年度") = d1.Year …… end if
|