以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]有点甜等高手老师们,这个分数怎么得出!  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=115417)

--  作者:tygzjsl
--  发布时间:2018/3/7 8:43:00
--  [求助]有点甜等高手老师们,这个分数怎么得出!

图片点击可在新窗口打开查看此主题相关图片如下:2.png
图片点击可在新窗口打开查看

图片点击可在新窗口打开查看此主题相关图片如下:1.png
图片点击可在新窗口打开查看

我想在textbox3中输入一个分数,点查询按钮会在textbox4显示排名(最好在最高和最低排名,不然只显示最低排名,然后根据这个排名,对比去年相同的排名,得出相当于去年的分数,显示在textbox5,这太难了,怎么做到啊

--  作者:有点甜
--  发布时间:2018/3/7 8:52:00
--  

Dim v1 = e.form.controls("TextBox3").text

Dim fdr As DataRow = DataTables("表A").find("分数 = \'" & v1 & "\'")

If fdr IsNot Nothing Then

    msgbox(fdr("排名"))

    Dim dr As DataRow = DataTables("表A").find("去年排名 <= " & fdr("排名") & "", "去年排名 desc")

    msgbox(dr("去年分数"))

    Dim dr2 As DataRow = DataTables("表A").find("去年排名 >= " & fdr("排名") & "", "去年排名")

    msgbox(dr2("去年分数"))

End If


--  作者:有点甜
--  发布时间:2018/3/7 8:53:00
--  

分数列、排名列,请改成整数列,不能用字符列。


--  作者:tygzjsl
--  发布时间:2018/3/7 9:14:00
--  
非常感谢,这么及时,我调试了,也出现结果了,非常准确,只是没有显示在输入框中

图片点击可在新窗口打开查看此主题相关图片如下:4.png
图片点击可在新窗口打开查看


--  作者:有点甜
--  发布时间:2018/3/7 10:30:00
--  

给控件赋值,这样写代码,如

 

e.Form.Controls("TextBox4").Text = fdr("排名")

e.Form.Controls("TextBox5").Text = dr("去年分数")

[此贴子已经被作者于2018/3/7 14:49:43编辑过]

--  作者:tygzjsl
--  发布时间:2018/3/7 10:48:00
--  
怎么可控件赋值啊
--  作者:有点甜
--  发布时间:2018/3/7 10:59:00
--  
没看懂5楼代码,你把msgbox改成5楼代码即可。
--  作者:tygzjsl
--  发布时间:2018/3/7 13:45:00
--  
Dim v1 = e.form.controls("TextBox3").text
Dim fdr As DataRow = DataTables("分数排名表").find("分数 = \'" & v1 & "\'")
If fdr IsNot Nothing Then
    e.Form.Controls("TextBox4").Text = fdr("排名")
    Dim dr As DataRow = DataTables("分数排名表").find("去年排名 <= " & fdr("排名") & "", "去年排名 desc")
    e.Form.Controls("TextBoxt5").Text = dr("去年分数")
    Dim dr2 As DataRow = DataTables("分数排名表").find("去年排名 >= " & fdr("排名") & "", "去年排名")
    e.Form.Controls("TextBoxt5").Text = dr("去年分数")
   End If

是这样么,textbox4显示了,可是textbox5显示这样的信息

图片点击可在新窗口打开查看此主题相关图片如下:7.png
图片点击可在新窗口打开查看


--  作者:有点甜
--  发布时间:2018/3/7 14:51:00
--  
Dim v1 = e.form.controls("TextBox3").text
Dim fdr As DataRow = DataTables("分数排名表").find("分数 = \'" & v1 & "\'")
If fdr IsNot Nothing Then
    e.Form.Controls("TextBox4").Text = fdr("排名")
    Dim dr As DataRow = DataTables("分数排名表").find("去年排名 <= " & fdr("排名") & "", "去年排名 desc")
    Dim dr2 As DataRow = DataTables("分数排名表").find("去年排名 >= " & fdr("排名") & "", "去年排名")
    e.Form.Controls("TextBox5").Text = dr2("去年分数") & "-" & dr("去年分数")
End If

--  作者:tygzjsl
--  发布时间:2018/3/7 15:11:00
--  
太棒啦,完全实现了,非常感谢!