以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  web数据源服务端保存未引用对象实例  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=174986)

--  作者:weibu
--  发布时间:2022/2/14 17:06:00
--  web数据源服务端保存未引用对象实例
老师,web数据源服务端开启服务后,更几天自己会弹出多个,“未引用对象实例”的报错窗口。而且是天数越多,自动弹出的窗口越多。这是什么原因引起的?就是按照咱们帮助文件的实例三层架构中的服务端代码做的,很简单。
--  作者:有点蓝
--  发布时间:2022/2/14 17:09:00
--  
服务端的代码都发上来看看
--  作者:weibu
--  发布时间:2022/2/14 19:30:00
--  
4、假定服务端建立的本地数据源的名称为"Orders",现在将HttpRequest事件代码设置为:

Dim Verified As Boolean
If e.PostValues.ContainsKey("username") AndAlso e.PostValues.ContainsKey("password") Then
    \'实际开发的时候,请改为根据用户表验证身份
    Dim username As String  = e.PostValues("username")
    Dim password As String  = e.PostValues("password")
    If username = "张三" AndAlso password = "888" Then
        Verified  = True
    End If
End If
If Verified = False Then
    e.AppendCookie("Error","用户身份验证失败!") \'通过Cookie返回错误信息.
    Return
End If
Select Case e.Path
    Case "DataServer.htm"
        e.AsDataServer("Orders")  \'将一个本地数据源公开为Web数据源
End Select

就是一步一步按照帮助文档做的

--  作者:有点蓝
--  发布时间:2022/2/14 20:07:00
--  
请帖自己的代码。不要贴帮助代码
--  作者:weibu
--  发布时间:2022/4/19 12:41:00
--  
 老师服务端还是偶发性弹出“未引用对象实例”的报错窗口。而且是天数越多,自动弹出的窗口越多。

httprequest代码:

Dim Verified As Boolean
If e.PostValues.ContainsKey("username") AndAlso e.PostValues.ContainsKey("password") Then
    \'实际开发的时候,请改为根据用户表验证身份
    Dim username As String  = e.PostValues("username")
    Dim password As String  = e.PostValues("password")
    If username = "张三" AndAlso password = "888" Then
        Verified  = True
    End If
End If
If Verified = False Then
    e.AppendCookie("Error","用户身份验证失败!") \'通过Cookie返回错误信息.
    Return
End If
Select Case e.Path
    Case "DataServer.htm"
        e.AsDataServer("wbsy")  \'将一个本地数据源公开为Web数据源
End Select

AfterOpenProject代码:


HttpServer.Prefixes.Add("http://*:9808/")

HttpServer.WebPath = "c:\\wbweb"  \'指定静态文件存储位置

HttpServer.Start()


开启服务按钮代码:


HttpServer.Prefixes.Add("http://*:9808/")

HttpServer.WebPath = "c:\\wbweb"  \'指定静态文件存储位置

HttpServer.Start()


--  作者:有点蓝
--  发布时间:2022/4/19 13:33:00
--  
屏蔽弹出的错误,改为使用日志记录

http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=173590