以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  关于web数据源的问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=124482)

--  作者:YDS
--  发布时间:2018/9/7 9:27:00
--  关于web数据源的问题
我想用web数据源建立多账套,客户登陆的时候先输入服务器的ip、端口、用户名、密码  然后进行连接   连接以后可以显示服务器的所有对该用户开放的数据源   客户根据需要   选择相应的账套   这样可以实现吗?要如何做?
--  作者:有点蓝
--  发布时间:2018/9/7 9:49:00
--  
参考示例二:http://www.foxtable.com/webhelp/scr/0682.htm
--  作者:YDS
--  发布时间:2018/9/7 10:33:00
--  
老师  这个我知道的  我的意思是web一个网址对应一个数据源   我再登陆的时候要怎么检索?

比如服务端
Select Case e.Path
   
Case "sjy1.htm"
        e.AsDataServer("数据源1")

   
Case "sjy2.htm"
        e.AsDataServer("数据源2")
    Case "sjy3.htm"
          e.AsDataServer("数据源3")

End
Select

我在客户端要怎么弄?

--  作者:有点蓝
--  发布时间:2018/9/7 10:50:00
--  
Select Case e.Path
    Case "sjy.htm"
e.WriteString("sjy1.htm|sjy2.htm|sjy3.htm")
    Case "sjy1.htm"
        e.AsDataServer("数据源1")

    
Case "sjy2.htm"
        e.AsDataServer("数据源2")
    Case "sjy3.htm"
          e.AsDataServer("数据源3")

End
 Select

客户端:
Dim hc As New HttpClient("http://127.0.0.1/sjy.htm")
Dim
 s As string = hc.GetData()
MessageBox
.Show(s)

--  作者:YDS
--  发布时间:2018/9/7 18:59:00
--  
客户端发送表单
Dim hc As New HttpClient("http://" & e.Form.Controls("SIP").text & ":" & e.Form.Controls("SPort").text & "/sjyget.htm")
hc.FormData.Add("cn",e.Form.Controls("computerName").text)
hc.FormData.Add("IP",e.Form.Controls("IP").text)
hc.FormData.Add("ID",e.Form.Controls("ID").text)
Dim s As String = hc.GetData()

服务端sjyget.htm代码
Dim e As RequestEventArgs = args(0)
Dim Verified As Boolean
Dim cn As String  = e.PostValues("cn")
Dim ip As String  = e.PostValues("IP")
Dim id As String  = e.PostValues("ID")
Dim dr As DataRow = DataTables("客户端授权表").Find("ID = \'" & id & "\'")
If dr IsNot Nothing AndAlso dr("AUTH") = 1 Then
    Verified = True
    dr("TIME") = Date.now
    dr.save
End If
If dr Is Nothing Then
    Dim nr As DataRow = DataTables("客户端授权表").addnew
    nr("NAME") = cn
    nr("IP") = ip
    nr("ID") = id
    nr("AUTH") = 0
    nr("AUTHM") = EncryptText(id,"#xo#","#ar#")
    nr("TIME") = Date.now
    Verified = False
    nr.save
End If
If Verified = False Then
    e.AppendCookie("Error","用户身份验证失败!")
    Return ""
End If
Select Case e.Path
    Case "sjyget.htm"
        e.WriteString(DataTables("账套管理表").GetComboListString("账套名称"))
End Select


为什么客户端
Dim s As String = hc.GetData() 
得到的S始终为空

--  作者:有点蓝
--  发布时间:2018/9/7 21:12:00
--  
贴出httprequest代码看看

If Verified = False Then
    e.AppendCookie("Error","用户身份验证失败!")
    e.WriteString("用户身份验证失败!")
    Return ""
End If
Select Case e.Path
    Case "sjyget.htm"
        e.WriteString(DataTables("账套管理表").GetComboListString("账套名称"))
End Select

--  作者:YDS
--  发布时间:2018/9/7 21:29:00
--  
错误的时候没有问题,我的意思是正确的时候返回的也是nothing
--  作者:有点蓝
--  发布时间:2018/9/7 21:49:00
--  
贴出httprequest代码看看!!!


Select Case e.Path
    Case "sjyget.htm"
msgbox(DataTables("账套管理表").GetComboListString("账套名称")) ‘这里能不能弹出来内容’
        e.WriteString(DataTables("账套管理表").GetComboListString("账套名称"))
End Select

--  作者:YDS
--  发布时间:2018/9/8 7:55:00
--  
问题解决了

If dr IsNot Nothing AndAlso dr("AUTH") = 1 Then

改成

If dr IsNot Nothing AndAlso dr("AUTH") = True Then

就可以了    但是不知道为什么会这样

--  作者:有点蓝
--  发布时间:2018/9/8 8:46:00
--  
逻辑型当然是true和false,又不是SQL语句