以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]关于sqlselect  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=123864)

--  作者:81538475
--  发布时间:2018/8/24 23:59:00
--  [求助]关于sqlselect
datacolchanged 代码
       e.DataRow.Save()
        Dim sum As Double
        Dim R As Row = Tables("XMFP").Current 
        Dim BH As String = e.DataRow("BH")
        Dim rw As String = e.DataRow("任务").replace("\'", "\'\'")    
        sum = DataTables("XMFP").SQLCompute("Sum(当月人天)","任务= \'"& rw & "\' and BH = \'" & BH & "\' ")    
        Dim drs As List(Of DataRow)
        drs = DataTables("XMFP").SQLSe/ect("任务= \'" & rw & "\' and BH = \'" & BH & "\'")
        Dim sy As Double = e.DataRow("任务人天")- sum
        For Each dr2 As DataRow In drs
        msgbox(dr2("当月人天"))
            dr2("剩余人天") = sy         
        Next

这个代码是哪里的问题提呢。dr2(“剩余人天”)计算出来了,也是正确的。但是没有写入对应的单元格。
去掉sql就可以计算。但是这里我需要用到sqlse/ect

--  作者:有点蓝
--  发布时间:2018/8/25 8:38:00
--  
1、sqlxxxx系列的用法都是直接写数据库的,不会更改界面的数据,要重新加载才会刷新

2、上面的代码只是赋值,没有保存:http://www.foxtable.com/webhelp/scr/2901.htm

--  作者:81538475
--  发布时间:2018/8/25 10:18:00
--  
那有其他代码可以代替吗
--  作者:有点蓝
--  发布时间:2018/8/25 11:03:00
--  
1、使用select:DataTables("XMFP").Se/ect

2、看2楼第二条

--  作者:81538475
--  发布时间:2018/8/25 13:30:00
--  
  DataTables("XMFP").SQLUpdate(drs)


        For Each dr3 As DataRow In drs
            dr3.Load()
        Next
我后面想把这些行重新加载出来。报错了。这个load的命令应该怎么用呢。

--  作者:有点蓝
--  发布时间:2018/8/25 14:03:00
--  
DataTables("XMFP").SQLUpdate(drs)
DataTables("XMFP").RemoveFor("任务= \'" & rw & "\' and BH = \'" & BH & "\' ")
DataTables("XMFP").AppendLoad("任务= \'" & rw & "\' and BH = \'" & BH & "\' ")

--  作者:81538475
--  发布时间:2018/8/25 18:19:00
--  
DataTables(“表A").DataRows(1).Load()
另外想了解下,上面的代码中的红色位置是表格上面的行号,还是_indentify 呢。还有就是如何获得选择行的这个序号。

--  作者:81538475
--  发布时间:2018/8/25 20:18:00
--  
解决了